@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,587 @@
|
|
|
1
|
+
# SegmentedControl
|
|
2
|
+
|
|
3
|
+
A segmented control component built with Vue 3 Composition API and TypeScript. The SegmentedControl component provides a sleek, animated interface for selecting between multiple options with smooth transitions and visual feedback.
|
|
4
|
+
|
|
5
|
+
## Installation/Import
|
|
6
|
+
|
|
7
|
+
```typescript
|
|
8
|
+
import { SegmentedControl } from "@umbra-ui/core";
|
|
9
|
+
import type { ControlItem } from "@umbra-ui/core";
|
|
10
|
+
```
|
|
11
|
+
|
|
12
|
+
**Dependencies:**
|
|
13
|
+
|
|
14
|
+
- Vue 3.x
|
|
15
|
+
|
|
16
|
+
## Basic Usage
|
|
17
|
+
|
|
18
|
+
```vue
|
|
19
|
+
<script setup lang="ts">
|
|
20
|
+
import { ref } from "vue";
|
|
21
|
+
import { SegmentedControl } from "@umbra-ui/core";
|
|
22
|
+
import type { ControlItem } from "@umbra-ui/core";
|
|
23
|
+
|
|
24
|
+
const selectedIndex = ref(0);
|
|
25
|
+
|
|
26
|
+
const segments: ControlItem[] = [
|
|
27
|
+
{ title: "Option 1" },
|
|
28
|
+
{ title: "Option 2" },
|
|
29
|
+
{ title: "Option 3" },
|
|
30
|
+
];
|
|
31
|
+
|
|
32
|
+
const handleSegmentClick = (index: number, item: ControlItem) => {
|
|
33
|
+
console.log("Selected:", item.title, "at index:", index);
|
|
34
|
+
selectedIndex.value = index;
|
|
35
|
+
};
|
|
36
|
+
</script>
|
|
37
|
+
|
|
38
|
+
<template>
|
|
39
|
+
<SegmentedControl
|
|
40
|
+
:items="segments"
|
|
41
|
+
:selected-index="selectedIndex"
|
|
42
|
+
@click="handleSegmentClick"
|
|
43
|
+
/>
|
|
44
|
+
</template>
|
|
45
|
+
```
|
|
46
|
+
|
|
47
|
+
## Props
|
|
48
|
+
|
|
49
|
+
| Prop Name | Type | Required | Default | Description |
|
|
50
|
+
| --------------- | --------------- | -------- | ---------------------------------------------------------- | --------------------------------------- |
|
|
51
|
+
| `items` | `ControlItem[]` | Yes | `[{ title: "One" }, { title: "Two" }, { title: "Three" }]` | Array of segment options to display |
|
|
52
|
+
| `selectedIndex` | `number` | No | `0` | Index of the currently selected segment |
|
|
53
|
+
|
|
54
|
+
### ControlItem Interface
|
|
55
|
+
|
|
56
|
+
```typescript
|
|
57
|
+
interface ControlItem {
|
|
58
|
+
title: string;
|
|
59
|
+
subtitle?: string;
|
|
60
|
+
disabled?: boolean;
|
|
61
|
+
}
|
|
62
|
+
```
|
|
63
|
+
|
|
64
|
+
## Events
|
|
65
|
+
|
|
66
|
+
| Event Name | Payload Type | Description |
|
|
67
|
+
| ---------------------- | ------------------------------------ | ---------------------------------------- |
|
|
68
|
+
| `update:selectedIndex` | `number` | Emitted when selection changes (v-model) |
|
|
69
|
+
| `click` | `[index: number, item: ControlItem]` | Emitted when a segment is clicked |
|
|
70
|
+
|
|
71
|
+
### Event Examples
|
|
72
|
+
|
|
73
|
+
```vue
|
|
74
|
+
<script setup lang="ts">
|
|
75
|
+
import { ref } from "vue";
|
|
76
|
+
import { SegmentedControl } from "@umbra-ui/core";
|
|
77
|
+
import type { ControlItem } from "@umbra-ui/core";
|
|
78
|
+
|
|
79
|
+
const selectedIndex = ref(0);
|
|
80
|
+
|
|
81
|
+
const handleSelectedIndexUpdate = (index: number) => {
|
|
82
|
+
console.log("Selected index updated:", index);
|
|
83
|
+
selectedIndex.value = index;
|
|
84
|
+
};
|
|
85
|
+
|
|
86
|
+
const handleSegmentClick = (index: number, item: ControlItem) => {
|
|
87
|
+
console.log("Segment clicked:", item.title);
|
|
88
|
+
console.log("Segment index:", index);
|
|
89
|
+
};
|
|
90
|
+
</script>
|
|
91
|
+
|
|
92
|
+
<template>
|
|
93
|
+
<SegmentedControl
|
|
94
|
+
:items="segments"
|
|
95
|
+
:selected-index="selectedIndex"
|
|
96
|
+
@update:selected-index="handleSelectedIndexUpdate"
|
|
97
|
+
@click="handleSegmentClick"
|
|
98
|
+
/>
|
|
99
|
+
</template>
|
|
100
|
+
```
|
|
101
|
+
|
|
102
|
+
## Slots
|
|
103
|
+
|
|
104
|
+
This component does not use slots. All content is controlled via props.
|
|
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 SegmentedControl component uses CSS custom properties that can be overridden to customize the appearance:
|
|
113
|
+
|
|
114
|
+
### Color Variables
|
|
115
|
+
|
|
116
|
+
```css
|
|
117
|
+
/* SegmentedControl colors */
|
|
118
|
+
--segmentedcontrol-bg: #f0f0f0;
|
|
119
|
+
--segmentedcontrol-selected-bg: white;
|
|
120
|
+
--segmentedcontrol-text-color: #60646c;
|
|
121
|
+
--segmentedcontrol-selected-text-color: #646464;
|
|
122
|
+
--segmentedcontrol-hover-bg: rgba(0, 0, 0, 0.04);
|
|
123
|
+
--segmentedcontrol-selected-hover-bg: white;
|
|
124
|
+
|
|
125
|
+
/* Border and styling */
|
|
126
|
+
--segmentedcontrol-border: 1px solid #d9d9d9;
|
|
127
|
+
--segmentedcontrol-border-radius: 0.353rem;
|
|
128
|
+
--segmentedcontrol-selected-border-radius: 0.353rem;
|
|
129
|
+
--segmentedcontrol-selected-border: 1px solid white;
|
|
130
|
+
|
|
131
|
+
/* Shadow */
|
|
132
|
+
--segmentedcontrol-shadow-dark: transparent;
|
|
133
|
+
--segmentedcontrol-shadow-light: transparent;
|
|
134
|
+
--segmentedcontrol-box-shadow: 0px 1px 0px 0px var(--segmentedcontrol-shadow-dark),
|
|
135
|
+
inset 0px 1px 0px 0px var(--segmentedcontrol-shadow-light);
|
|
136
|
+
```
|
|
137
|
+
|
|
138
|
+
### Custom Styling Example
|
|
139
|
+
|
|
140
|
+
```vue
|
|
141
|
+
<template>
|
|
142
|
+
<SegmentedControl
|
|
143
|
+
:items="items"
|
|
144
|
+
:selected-index="selectedIndex"
|
|
145
|
+
class="custom-segmented-control"
|
|
146
|
+
/>
|
|
147
|
+
</template>
|
|
148
|
+
|
|
149
|
+
<style>
|
|
150
|
+
.custom-segmented-control {
|
|
151
|
+
--segmentedcontrol-bg: #f8f9fa;
|
|
152
|
+
--segmentedcontrol-selected-bg: #ff6b6b;
|
|
153
|
+
--segmentedcontrol-selected-text-color: #ffffff;
|
|
154
|
+
--segmentedcontrol-text-color: #666;
|
|
155
|
+
}
|
|
156
|
+
</style>
|
|
157
|
+
```
|
|
158
|
+
|
|
159
|
+
## Examples
|
|
160
|
+
|
|
161
|
+
### Basic Segmented Control
|
|
162
|
+
|
|
163
|
+
```vue
|
|
164
|
+
<script setup lang="ts">
|
|
165
|
+
import { ref } from "vue";
|
|
166
|
+
import { SegmentedControl } from "@umbra-ui/core";
|
|
167
|
+
import type { ControlItem } from "@umbra-ui/core";
|
|
168
|
+
|
|
169
|
+
const selectedIndex = ref(0);
|
|
170
|
+
|
|
171
|
+
const options: ControlItem[] = [
|
|
172
|
+
{ title: "All" },
|
|
173
|
+
{ title: "Active" },
|
|
174
|
+
{ title: "Inactive" },
|
|
175
|
+
];
|
|
176
|
+
</script>
|
|
177
|
+
|
|
178
|
+
<template>
|
|
179
|
+
<SegmentedControl
|
|
180
|
+
:items="options"
|
|
181
|
+
:selected-index="selectedIndex"
|
|
182
|
+
@click="(index) => (selectedIndex = index)"
|
|
183
|
+
/>
|
|
184
|
+
</template>
|
|
185
|
+
```
|
|
186
|
+
|
|
187
|
+
### View Mode Selector
|
|
188
|
+
|
|
189
|
+
```vue
|
|
190
|
+
<script setup lang="ts">
|
|
191
|
+
import { ref } from "vue";
|
|
192
|
+
import { SegmentedControl } from "@umbra-ui/core";
|
|
193
|
+
import type { ControlItem } from "@umbra-ui/core";
|
|
194
|
+
|
|
195
|
+
const viewMode = ref(0);
|
|
196
|
+
|
|
197
|
+
const viewModes: ControlItem[] = [
|
|
198
|
+
{ title: "Grid" },
|
|
199
|
+
{ title: "List" },
|
|
200
|
+
{ title: "Card" },
|
|
201
|
+
];
|
|
202
|
+
|
|
203
|
+
const handleViewModeChange = (index: number) => {
|
|
204
|
+
viewMode.value = index;
|
|
205
|
+
console.log("View mode changed to:", viewModes[index].title);
|
|
206
|
+
};
|
|
207
|
+
</script>
|
|
208
|
+
|
|
209
|
+
<template>
|
|
210
|
+
<div class="view-selector">
|
|
211
|
+
<h3>View Mode</h3>
|
|
212
|
+
<SegmentedControl
|
|
213
|
+
:items="viewModes"
|
|
214
|
+
:selected-index="viewMode"
|
|
215
|
+
@click="handleViewModeChange"
|
|
216
|
+
/>
|
|
217
|
+
</div>
|
|
218
|
+
</template>
|
|
219
|
+
|
|
220
|
+
<style module>
|
|
221
|
+
.view-selector {
|
|
222
|
+
display: flex;
|
|
223
|
+
flex-direction: column;
|
|
224
|
+
gap: 1rem;
|
|
225
|
+
align-items: center;
|
|
226
|
+
}
|
|
227
|
+
</style>
|
|
228
|
+
```
|
|
229
|
+
|
|
230
|
+
### Filter Controls
|
|
231
|
+
|
|
232
|
+
```vue
|
|
233
|
+
<script setup lang="ts">
|
|
234
|
+
import { ref } from "vue";
|
|
235
|
+
import { SegmentedControl } from "@umbra-ui/core";
|
|
236
|
+
import type { ControlItem } from "@umbra-ui/core";
|
|
237
|
+
|
|
238
|
+
const statusFilter = ref(0);
|
|
239
|
+
const categoryFilter = ref(0);
|
|
240
|
+
|
|
241
|
+
const statusOptions: ControlItem[] = [
|
|
242
|
+
{ title: "All" },
|
|
243
|
+
{ title: "Published" },
|
|
244
|
+
{ title: "Draft" },
|
|
245
|
+
{ title: "Archived" },
|
|
246
|
+
];
|
|
247
|
+
|
|
248
|
+
const categoryOptions: ControlItem[] = [
|
|
249
|
+
{ title: "All" },
|
|
250
|
+
{ title: "Tech" },
|
|
251
|
+
{ title: "Design" },
|
|
252
|
+
{ title: "Business" },
|
|
253
|
+
];
|
|
254
|
+
|
|
255
|
+
const applyFilters = () => {
|
|
256
|
+
const filters = {
|
|
257
|
+
status: statusOptions[statusFilter.value].title,
|
|
258
|
+
category: categoryOptions[categoryFilter.value].title,
|
|
259
|
+
};
|
|
260
|
+
console.log("Applied filters:", filters);
|
|
261
|
+
};
|
|
262
|
+
</script>
|
|
263
|
+
|
|
264
|
+
<template>
|
|
265
|
+
<div class="filter-controls">
|
|
266
|
+
<div class="filter-group">
|
|
267
|
+
<label>Status</label>
|
|
268
|
+
<SegmentedControl
|
|
269
|
+
:items="statusOptions"
|
|
270
|
+
:selected-index="statusFilter"
|
|
271
|
+
@click="(index) => (statusFilter = index)"
|
|
272
|
+
/>
|
|
273
|
+
</div>
|
|
274
|
+
|
|
275
|
+
<div class="filter-group">
|
|
276
|
+
<label>Category</label>
|
|
277
|
+
<SegmentedControl
|
|
278
|
+
:items="categoryOptions"
|
|
279
|
+
:selected-index="categoryFilter"
|
|
280
|
+
@click="(index) => (categoryFilter = index)"
|
|
281
|
+
/>
|
|
282
|
+
</div>
|
|
283
|
+
|
|
284
|
+
<button @click="applyFilters">Apply Filters</button>
|
|
285
|
+
</div>
|
|
286
|
+
</template>
|
|
287
|
+
|
|
288
|
+
<style module>
|
|
289
|
+
.filter-controls {
|
|
290
|
+
display: flex;
|
|
291
|
+
flex-direction: column;
|
|
292
|
+
gap: 2rem;
|
|
293
|
+
max-width: 400px;
|
|
294
|
+
}
|
|
295
|
+
|
|
296
|
+
.filter-group {
|
|
297
|
+
display: flex;
|
|
298
|
+
flex-direction: column;
|
|
299
|
+
gap: 1rem;
|
|
300
|
+
}
|
|
301
|
+
</style>
|
|
302
|
+
```
|
|
303
|
+
|
|
304
|
+
### Settings Panel
|
|
305
|
+
|
|
306
|
+
```vue
|
|
307
|
+
<script setup lang="ts">
|
|
308
|
+
import { ref } from "vue";
|
|
309
|
+
import { SegmentedControl } from "@umbra-ui/core";
|
|
310
|
+
import type { ControlItem } from "@umbra-ui/core";
|
|
311
|
+
|
|
312
|
+
const themeMode = ref(0);
|
|
313
|
+
const languageMode = ref(0);
|
|
314
|
+
const notificationMode = ref(0);
|
|
315
|
+
|
|
316
|
+
const themeOptions: ControlItem[] = [
|
|
317
|
+
{ title: "Light" },
|
|
318
|
+
{ title: "Dark" },
|
|
319
|
+
{ title: "Auto" },
|
|
320
|
+
];
|
|
321
|
+
|
|
322
|
+
const languageOptions: ControlItem[] = [
|
|
323
|
+
{ title: "EN" },
|
|
324
|
+
{ title: "ES" },
|
|
325
|
+
{ title: "FR" },
|
|
326
|
+
{ title: "DE" },
|
|
327
|
+
];
|
|
328
|
+
|
|
329
|
+
const notificationOptions: ControlItem[] = [
|
|
330
|
+
{ title: "All" },
|
|
331
|
+
{ title: "Mentions" },
|
|
332
|
+
{ title: "None" },
|
|
333
|
+
];
|
|
334
|
+
|
|
335
|
+
const saveSettings = () => {
|
|
336
|
+
const settings = {
|
|
337
|
+
theme: themeOptions[themeMode.value].title,
|
|
338
|
+
language: languageOptions[languageMode.value].title,
|
|
339
|
+
notifications: notificationOptions[notificationMode.value].title,
|
|
340
|
+
};
|
|
341
|
+
console.log("Settings saved:", settings);
|
|
342
|
+
};
|
|
343
|
+
</script>
|
|
344
|
+
|
|
345
|
+
<template>
|
|
346
|
+
<div class="settings-panel">
|
|
347
|
+
<h2>Settings</h2>
|
|
348
|
+
|
|
349
|
+
<div class="setting-group">
|
|
350
|
+
<label>Theme</label>
|
|
351
|
+
<SegmentedControl
|
|
352
|
+
:items="themeOptions"
|
|
353
|
+
:selected-index="themeMode"
|
|
354
|
+
@click="(index) => (themeMode = index)"
|
|
355
|
+
/>
|
|
356
|
+
</div>
|
|
357
|
+
|
|
358
|
+
<div class="setting-group">
|
|
359
|
+
<label>Language</label>
|
|
360
|
+
<SegmentedControl
|
|
361
|
+
:items="languageOptions"
|
|
362
|
+
:selected-index="languageMode"
|
|
363
|
+
@click="(index) => (languageMode = index)"
|
|
364
|
+
/>
|
|
365
|
+
</div>
|
|
366
|
+
|
|
367
|
+
<div class="setting-group">
|
|
368
|
+
<label>Notifications</label>
|
|
369
|
+
<SegmentedControl
|
|
370
|
+
:items="notificationOptions"
|
|
371
|
+
:selected-index="notificationMode"
|
|
372
|
+
@click="(index) => (notificationMode = index)"
|
|
373
|
+
/>
|
|
374
|
+
</div>
|
|
375
|
+
|
|
376
|
+
<button @click="saveSettings">Save Settings</button>
|
|
377
|
+
</div>
|
|
378
|
+
</template>
|
|
379
|
+
|
|
380
|
+
<style module>
|
|
381
|
+
.settings-panel {
|
|
382
|
+
display: flex;
|
|
383
|
+
flex-direction: column;
|
|
384
|
+
gap: 2rem;
|
|
385
|
+
max-width: 400px;
|
|
386
|
+
padding: 2rem;
|
|
387
|
+
background-color: #f5f5f5;
|
|
388
|
+
border-radius: 0.5rem;
|
|
389
|
+
}
|
|
390
|
+
|
|
391
|
+
.setting-group {
|
|
392
|
+
display: flex;
|
|
393
|
+
flex-direction: column;
|
|
394
|
+
gap: 1rem;
|
|
395
|
+
}
|
|
396
|
+
</style>
|
|
397
|
+
```
|
|
398
|
+
|
|
399
|
+
### Tab Navigation
|
|
400
|
+
|
|
401
|
+
```vue
|
|
402
|
+
<script setup lang="ts">
|
|
403
|
+
import { ref } from "vue";
|
|
404
|
+
import { SegmentedControl } from "@umbra-ui/core";
|
|
405
|
+
import type { ControlItem } from "@umbra-ui/core";
|
|
406
|
+
|
|
407
|
+
const activeTab = ref(0);
|
|
408
|
+
|
|
409
|
+
const tabs: ControlItem[] = [
|
|
410
|
+
{ title: "Overview" },
|
|
411
|
+
{ title: "Analytics" },
|
|
412
|
+
{ title: "Reports" },
|
|
413
|
+
{ title: "Settings" },
|
|
414
|
+
];
|
|
415
|
+
|
|
416
|
+
const tabContent = ref([
|
|
417
|
+
"Overview content goes here...",
|
|
418
|
+
"Analytics content goes here...",
|
|
419
|
+
"Reports content goes here...",
|
|
420
|
+
"Settings content goes here...",
|
|
421
|
+
]);
|
|
422
|
+
|
|
423
|
+
const handleTabChange = (index: number) => {
|
|
424
|
+
activeTab.value = index;
|
|
425
|
+
};
|
|
426
|
+
</script>
|
|
427
|
+
|
|
428
|
+
<template>
|
|
429
|
+
<div class="tab-navigation">
|
|
430
|
+
<SegmentedControl
|
|
431
|
+
:items="tabs"
|
|
432
|
+
:selected-index="activeTab"
|
|
433
|
+
@click="handleTabChange"
|
|
434
|
+
/>
|
|
435
|
+
|
|
436
|
+
<div class="tab-content">
|
|
437
|
+
<h3>{{ tabs[activeTab].title }}</h3>
|
|
438
|
+
<p>{{ tabContent[activeTab] }}</p>
|
|
439
|
+
</div>
|
|
440
|
+
</div>
|
|
441
|
+
</template>
|
|
442
|
+
|
|
443
|
+
<style module>
|
|
444
|
+
.tab-navigation {
|
|
445
|
+
display: flex;
|
|
446
|
+
flex-direction: column;
|
|
447
|
+
gap: 2rem;
|
|
448
|
+
max-width: 600px;
|
|
449
|
+
}
|
|
450
|
+
|
|
451
|
+
.tab-content {
|
|
452
|
+
padding: 2rem;
|
|
453
|
+
background-color: #f8f9fa;
|
|
454
|
+
border-radius: 0.5rem;
|
|
455
|
+
min-height: 200px;
|
|
456
|
+
}
|
|
457
|
+
</style>
|
|
458
|
+
```
|
|
459
|
+
|
|
460
|
+
### Dynamic Segments
|
|
461
|
+
|
|
462
|
+
```vue
|
|
463
|
+
<script setup lang="ts">
|
|
464
|
+
import { ref, computed } from "vue";
|
|
465
|
+
import { SegmentedControl } from "@umbra-ui/core";
|
|
466
|
+
import type { ControlItem } from "@umbra-ui/core";
|
|
467
|
+
|
|
468
|
+
const selectedTimeframe = ref(0);
|
|
469
|
+
|
|
470
|
+
const timeframes: ControlItem[] = [
|
|
471
|
+
{ title: "1D" },
|
|
472
|
+
{ title: "1W" },
|
|
473
|
+
{ title: "1M" },
|
|
474
|
+
{ title: "3M" },
|
|
475
|
+
{ title: "1Y" },
|
|
476
|
+
{ title: "All" },
|
|
477
|
+
];
|
|
478
|
+
|
|
479
|
+
const selectedMetric = ref(0);
|
|
480
|
+
|
|
481
|
+
const metrics = computed(() => {
|
|
482
|
+
const baseMetrics: ControlItem[] = [
|
|
483
|
+
{ title: "Views" },
|
|
484
|
+
{ title: "Clicks" },
|
|
485
|
+
{ title: "Conversions" },
|
|
486
|
+
];
|
|
487
|
+
|
|
488
|
+
// Add more metrics based on timeframe
|
|
489
|
+
if (selectedTimeframe.value >= 2) {
|
|
490
|
+
baseMetrics.push({ title: "Revenue" });
|
|
491
|
+
}
|
|
492
|
+
|
|
493
|
+
if (selectedTimeframe.value >= 3) {
|
|
494
|
+
baseMetrics.push({ title: "ROI" });
|
|
495
|
+
}
|
|
496
|
+
|
|
497
|
+
return baseMetrics;
|
|
498
|
+
});
|
|
499
|
+
|
|
500
|
+
const handleTimeframeChange = (index: number) => {
|
|
501
|
+
selectedTimeframe.value = index;
|
|
502
|
+
// Reset metric selection if it's no longer available
|
|
503
|
+
if (selectedMetric.value >= metrics.value.length) {
|
|
504
|
+
selectedMetric.value = 0;
|
|
505
|
+
}
|
|
506
|
+
};
|
|
507
|
+
</script>
|
|
508
|
+
|
|
509
|
+
<template>
|
|
510
|
+
<div class="dynamic-controls">
|
|
511
|
+
<div class="control-group">
|
|
512
|
+
<label>Timeframe</label>
|
|
513
|
+
<SegmentedControl
|
|
514
|
+
:items="timeframes"
|
|
515
|
+
:selected-index="selectedTimeframe"
|
|
516
|
+
@click="handleTimeframeChange"
|
|
517
|
+
/>
|
|
518
|
+
</div>
|
|
519
|
+
|
|
520
|
+
<div class="control-group">
|
|
521
|
+
<label>Metric</label>
|
|
522
|
+
<SegmentedControl
|
|
523
|
+
:items="metrics"
|
|
524
|
+
:selected-index="selectedMetric"
|
|
525
|
+
@click="(index) => (selectedMetric = index)"
|
|
526
|
+
/>
|
|
527
|
+
</div>
|
|
528
|
+
|
|
529
|
+
<div class="selected-info">
|
|
530
|
+
<p>
|
|
531
|
+
Showing {{ metrics[selectedMetric].title }} for
|
|
532
|
+
{{ timeframes[selectedTimeframe].title }}
|
|
533
|
+
</p>
|
|
534
|
+
</div>
|
|
535
|
+
</div>
|
|
536
|
+
</template>
|
|
537
|
+
|
|
538
|
+
<style module>
|
|
539
|
+
.dynamic-controls {
|
|
540
|
+
display: flex;
|
|
541
|
+
flex-direction: column;
|
|
542
|
+
gap: 2rem;
|
|
543
|
+
max-width: 500px;
|
|
544
|
+
}
|
|
545
|
+
|
|
546
|
+
.control-group {
|
|
547
|
+
display: flex;
|
|
548
|
+
flex-direction: column;
|
|
549
|
+
gap: 1rem;
|
|
550
|
+
}
|
|
551
|
+
|
|
552
|
+
.selected-info {
|
|
553
|
+
padding: 1rem;
|
|
554
|
+
background-color: #e3f2fd;
|
|
555
|
+
border-radius: 0.25rem;
|
|
556
|
+
text-align: center;
|
|
557
|
+
}
|
|
558
|
+
</style>
|
|
559
|
+
```
|
|
560
|
+
|
|
561
|
+
## Animation Features
|
|
562
|
+
|
|
563
|
+
### Smooth Transitions
|
|
564
|
+
|
|
565
|
+
- **Selection Indicator**: Animated background that smoothly slides between segments
|
|
566
|
+
- **Width Animation**: The selection indicator dynamically adjusts its width to match the selected segment
|
|
567
|
+
- **Position Animation**: Uses cubic-bezier easing for natural movement
|
|
568
|
+
- **Color Transitions**: Smooth color changes for text and background
|
|
569
|
+
|
|
570
|
+
### Interactive Feedback
|
|
571
|
+
|
|
572
|
+
- **Hover Effects**: Subtle background color changes on hover
|
|
573
|
+
- **Active States**: Visual feedback when segments are clicked
|
|
574
|
+
- **Responsive Design**: Automatically adjusts to content width changes
|
|
575
|
+
|
|
576
|
+
## Notes
|
|
577
|
+
|
|
578
|
+
- The component includes smooth animations with cubic-bezier easing functions
|
|
579
|
+
- The selection indicator automatically adjusts its width and position based on the selected segment
|
|
580
|
+
- Hover effects provide visual feedback for better user experience
|
|
581
|
+
- The component supports both light and dark themes
|
|
582
|
+
- All interactions are fully accessible with proper click handling
|
|
583
|
+
- The component automatically handles window resize events to maintain proper positioning
|
|
584
|
+
- Segments are evenly distributed and the component adapts to different content lengths
|
|
585
|
+
- The selection indicator uses absolute positioning with smooth transforms for optimal performance
|
|
586
|
+
- Typography classes are properly overridden to ensure consistent styling
|
|
587
|
+
- The component is designed to be flexible and work well in various layout contexts
|