orio-ui 1.0.6 → 1.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/module.json
CHANGED
|
@@ -0,0 +1,66 @@
|
|
|
1
|
+
<script setup lang="ts">
|
|
2
|
+
interface Props {
|
|
3
|
+
disabled?: boolean;
|
|
4
|
+
}
|
|
5
|
+
|
|
6
|
+
const props = withDefaults(defineProps<Props>(), {
|
|
7
|
+
disabled: false,
|
|
8
|
+
});
|
|
9
|
+
|
|
10
|
+
const modelValue = defineModel<boolean>({ required: false });
|
|
11
|
+
|
|
12
|
+
function toggle() {
|
|
13
|
+
if (props.disabled) return;
|
|
14
|
+
modelValue.value = !modelValue.value;
|
|
15
|
+
}
|
|
16
|
+
</script>
|
|
17
|
+
|
|
18
|
+
<template>
|
|
19
|
+
<orio-control-element>
|
|
20
|
+
<button
|
|
21
|
+
class="switch-button"
|
|
22
|
+
:class="{ active: modelValue, disabled: disabled }"
|
|
23
|
+
:disabled="disabled"
|
|
24
|
+
@click="toggle"
|
|
25
|
+
@keydown.enter.prevent="toggle"
|
|
26
|
+
@keydown.space.prevent="toggle"
|
|
27
|
+
>
|
|
28
|
+
<slot />
|
|
29
|
+
</button>
|
|
30
|
+
</orio-control-element>
|
|
31
|
+
</template>
|
|
32
|
+
|
|
33
|
+
<style scoped>
|
|
34
|
+
.switch-button {
|
|
35
|
+
display: inline-flex;
|
|
36
|
+
align-items: center;
|
|
37
|
+
justify-content: center;
|
|
38
|
+
gap: 0.5rem;
|
|
39
|
+
border-radius: var(--border-radius-md);
|
|
40
|
+
background-color: var(--color-surface);
|
|
41
|
+
color: var(--color-muted);
|
|
42
|
+
border: 1px solid var(--color-border);
|
|
43
|
+
padding: 8px 16px;
|
|
44
|
+
font-size: 1rem;
|
|
45
|
+
line-height: 1.5;
|
|
46
|
+
cursor: pointer;
|
|
47
|
+
user-select: none;
|
|
48
|
+
transition: background-color 0.2s ease, color 0.2s ease, border-color 0.2s ease;
|
|
49
|
+
}
|
|
50
|
+
.switch-button:hover:not(.disabled) {
|
|
51
|
+
border-color: var(--color-accent);
|
|
52
|
+
}
|
|
53
|
+
.switch-button:focus-visible {
|
|
54
|
+
outline: 2px solid var(--color-accent);
|
|
55
|
+
outline-offset: 2px;
|
|
56
|
+
}
|
|
57
|
+
.switch-button.active {
|
|
58
|
+
background-color: var(--color-accent-soft);
|
|
59
|
+
color: var(--color-accent);
|
|
60
|
+
border-color: var(--color-accent);
|
|
61
|
+
}
|
|
62
|
+
.switch-button.disabled {
|
|
63
|
+
opacity: 0.5;
|
|
64
|
+
cursor: not-allowed;
|
|
65
|
+
}
|
|
66
|
+
</style>
|
package/dist/runtime/index.d.ts
CHANGED
|
@@ -2,6 +2,7 @@ export { default as Button } from './components/Button.vue.js';
|
|
|
2
2
|
export { default as Input } from './components/Input.vue.js';
|
|
3
3
|
export { default as Textarea } from './components/Textarea.vue.js';
|
|
4
4
|
export { default as CheckBox } from './components/CheckBox.vue.js';
|
|
5
|
+
export { default as SwitchButton } from './components/SwitchButton.vue.js';
|
|
5
6
|
export { default as DatePicker } from './components/DatePicker.vue.js';
|
|
6
7
|
export { default as DateRangePicker } from './components/DateRangePicker.vue.js';
|
|
7
8
|
export { default as Selector } from './components/Selector.vue.js';
|
package/dist/runtime/index.js
CHANGED
|
@@ -2,6 +2,7 @@ export { default as Button } from "./components/Button.vue";
|
|
|
2
2
|
export { default as Input } from "./components/Input.vue";
|
|
3
3
|
export { default as Textarea } from "./components/Textarea.vue";
|
|
4
4
|
export { default as CheckBox } from "./components/CheckBox.vue";
|
|
5
|
+
export { default as SwitchButton } from "./components/SwitchButton.vue";
|
|
5
6
|
export { default as DatePicker } from "./components/DatePicker.vue";
|
|
6
7
|
export { default as DateRangePicker } from "./components/DateRangePicker.vue";
|
|
7
8
|
export { default as Selector } from "./components/Selector.vue";
|