@toife/vue 3.1.3 → 3.1.5
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +1 -1
- package/package.json +1 -1
- package/src/components/action/action.scss +1 -1
- package/src/components/action/action.vue +5 -5
- package/src/components/app/app.scss +2 -2
- package/src/components/app/app.type.ts +6 -0
- package/src/components/app/app.vue +8 -2
- package/src/components/avatar/avatar.scss +6 -4
- package/src/components/avatar/avatar.vue +6 -6
- package/src/components/button/button.scss +19 -16
- package/src/components/button/button.type.ts +3 -1
- package/src/components/button/button.vue +7 -7
- package/src/components/cable/cable.vue +2 -2
- package/src/components/card/card/card.scss +5 -3
- package/src/components/card/card/card.vue +5 -5
- package/src/components/card/card-body/card-body.scss +2 -2
- package/src/components/card/card-body/card-body.vue +2 -2
- package/src/components/card/card-footer/card-footer.scss +3 -3
- package/src/components/card/card-footer/card-footer.vue +2 -2
- package/src/components/card/card-header/card-header.scss +3 -3
- package/src/components/card/card-header/card-header.vue +2 -2
- package/src/components/checkbox/checkbox.html +1 -1
- package/src/components/checkbox/checkbox.scss +27 -27
- package/src/components/checkbox/checkbox.type.ts +4 -0
- package/src/components/checkbox/checkbox.vue +8 -6
- package/src/components/collapse/collapse.html +1 -1
- package/src/components/collapse/collapse.scss +2 -2
- package/src/components/collapse/collapse.vue +9 -9
- package/src/components/container/container.vue +2 -2
- package/src/components/decision-modal/decision-modal.scss +12 -10
- package/src/components/decision-modal/decision-modal.vue +8 -8
- package/src/components/divider/divider.scss +2 -2
- package/src/components/divider/divider.vue +4 -4
- package/src/components/dropdown/dropdown.scss +8 -5
- package/src/components/dropdown/dropdown.type.ts +4 -1
- package/src/components/dropdown/dropdown.vue +8 -6
- package/src/components/field/field.type.ts +4 -4
- package/src/components/field/outline/outline.scss +24 -21
- package/src/components/field/outline/outline.vue +26 -18
- package/src/components/form-group/form-group.vue +2 -2
- package/src/components/gesture-indicator/gesture-indicator.scss +4 -2
- package/src/components/gesture-indicator/gesture-indicator.vue +4 -4
- package/src/components/image/image.vue +12 -5
- package/src/components/index.ts +1 -0
- package/src/components/layout/flex/flex.scss +0 -2
- package/src/components/layout/flex/flex.vue +8 -8
- package/src/components/layout/flex-item/flex-item.html +1 -0
- package/src/components/layout/flex-item/flex-item.scss +48 -0
- package/src/components/layout/flex-item/flex-item.type.ts +11 -0
- package/src/components/layout/flex-item/flex-item.vue +27 -0
- package/src/components/layout/flex-item/index.ts +2 -0
- package/src/components/layout/grid/grid.scss +0 -2
- package/src/components/layout/grid/grid.vue +6 -6
- package/src/components/layout/grid-item/grid-item.html +1 -0
- package/src/components/layout/grid-item/grid-item.scss +49 -0
- package/src/components/layout/grid-item/grid-item.type.ts +14 -0
- package/src/components/layout/grid-item/grid-item.vue +27 -0
- package/src/components/layout/grid-item/index.ts +2 -0
- package/src/components/layout/index.ts +2 -1
- package/src/components/modal/modal.scss +4 -2
- package/src/components/modal/modal.vue +68 -5
- package/src/components/page/page.vue +2 -2
- package/src/components/present/present.scss +3 -3
- package/src/components/present/present.vue +14 -14
- package/src/components/radio/radio/radio.html +1 -1
- package/src/components/radio/radio/radio.scss +25 -18
- package/src/components/radio/radio/radio.type.ts +4 -0
- package/src/components/radio/radio/radio.vue +7 -5
- package/src/components/radio/radio-group/radio-group.vue +2 -2
- package/src/components/refresher/refresher.html +1 -4
- package/src/components/refresher/refresher.scss +8 -26
- package/src/components/refresher/refresher.vue +2 -16
- package/src/components/route/route-navigator/route-navigator.scss +2 -2
- package/src/components/route/route-navigator/route-navigator.vue +10 -13
- package/src/components/route/route-wrapper/route-wrapper.composable.ts +5 -15
- package/src/components/route/route-wrapper/route-wrapper.type.ts +0 -4
- package/src/components/route/route-wrapper/route-wrapper.vue +4 -12
- package/src/components/route/route.type.ts +0 -1
- package/src/components/segmented-field/segmented-field.html +1 -1
- package/src/components/segmented-field/segmented-field.scss +2 -2
- package/src/components/segmented-field/segmented-field.vue +8 -8
- package/src/components/select/select.html +2 -2
- package/src/components/select/select.scss +10 -10
- package/src/components/select/select.vue +10 -10
- package/src/components/skeleton/skeleton.scss +3 -1
- package/src/components/skeleton/skeleton.vue +7 -7
- package/src/components/slide-range/index.ts +2 -0
- package/src/components/slide-range/slide-range.html +19 -0
- package/src/components/slide-range/slide-range.scss +161 -0
- package/src/components/slide-range/slide-range.type.ts +16 -0
- package/src/components/slide-range/slide-range.vue +229 -0
- package/src/components/switch/switch.html +1 -1
- package/src/components/switch/switch.scss +29 -38
- package/src/components/switch/switch.type.ts +6 -0
- package/src/components/switch/switch.vue +24 -8
- package/src/components/tabs/tab/tab.html +1 -1
- package/src/components/tabs/tab/tab.scss +13 -0
- package/src/components/tabs/tab/tab.vue +4 -2
- package/src/components/tabs/tabs/index.ts +1 -0
- package/src/components/tabs/tabs/tabs.scss +194 -122
- package/src/components/tabs/tabs/tabs.type.ts +5 -2
- package/src/components/tabs/tabs/tabs.vue +47 -27
- package/src/components/toast/toast/toast.vue +2 -2
- package/src/components/toast/toast-content/toast-content.scss +6 -5
- package/src/components/toast/toast-content/toast-content.vue +5 -5
- package/src/components/toolbar/toolbar.scss +4 -4
- package/src/components/toolbar/toolbar.type.ts +1 -1
- package/src/components/toolbar/toolbar.vue +7 -7
- package/src/factory.ts +108 -50
- package/src/index.ts +1 -1
- package/src/type.ts +2 -1
- package/src/utils/style/index.ts +9 -9
- package/src/utils/style.md +9 -9
- package/src/components/action/action.md +0 -115
- package/src/components/app/app.md +0 -77
- package/src/components/avatar/avatar.md +0 -64
- package/src/components/button/button.md +0 -66
- package/src/components/cable/cable.md +0 -57
- package/src/components/card/card/card.md +0 -57
- package/src/components/card/card-body/card-body.md +0 -34
- package/src/components/card/card-footer/card-footer.md +0 -42
- package/src/components/card/card-header/card-header.md +0 -44
- package/src/components/checkbox/checkbox.md +0 -60
- package/src/components/collapse/collapse.md +0 -59
- package/src/components/container/container.md +0 -38
- package/src/components/decision-modal/decision-modal.md +0 -79
- package/src/components/divider/divider.md +0 -42
- package/src/components/field/field.md +0 -68
- package/src/components/field/outline/outline-field.md +0 -44
- package/src/components/form-group/form-group.md +0 -41
- package/src/components/gesture-indicator/gesture-indicator.md +0 -42
- package/src/components/image/image.md +0 -41
- package/src/components/layout/cell/cell.html +0 -1
- package/src/components/layout/cell/cell.md +0 -47
- package/src/components/layout/cell/cell.scss +0 -54
- package/src/components/layout/cell/cell.type.ts +0 -19
- package/src/components/layout/cell/cell.vue +0 -35
- package/src/components/layout/cell/index.ts +0 -2
- package/src/components/layout/grid/grid.md +0 -50
- package/src/components/modal/modal.md +0 -65
- package/src/components/page/page.md +0 -39
- package/src/components/present/present.md +0 -60
- package/src/components/radio/radio/radio.md +0 -53
- package/src/components/radio/radio-group/radio-group.md +0 -62
- package/src/components/refresher/refresher.md +0 -53
- package/src/components/route/route-navigator/route-navigator.md +0 -50
- package/src/components/route/route-outlet/route-outlet.md +0 -30
- package/src/components/route/route-provider/route-provider.md +0 -46
- package/src/components/route/route-wrapper/route-wrapper.md +0 -45
- package/src/components/segmented-field/segmented-field.md +0 -58
- package/src/components/skeleton/skeleton.md +0 -47
- package/src/components/switch/switch.md +0 -57
- package/src/components/tabs/tab/tab.md +0 -52
- package/src/components/tabs/tabs/tabs.md +0 -59
- package/src/components/toast/toast/toast.md +0 -56
- package/src/components/toast/toast-content/toast-content.md +0 -41
- package/src/components/toolbar/toolbar.md +0 -54
|
@@ -11,7 +11,11 @@ $radio-background-color-unchecked: sass.fn-naming-var("radio", "background-color
|
|
|
11
11
|
$radio-background-color-checked: sass.fn-naming-var("radio", "background-color", "checked");
|
|
12
12
|
$radio-background-color-disabled: sass.fn-naming-var("radio", "background-color", "disabled");
|
|
13
13
|
|
|
14
|
-
$radio-color: sass.fn-naming-var("radio", "color");
|
|
14
|
+
$radio-color-unchecked: sass.fn-naming-var("radio", "color", "unchecked");
|
|
15
|
+
$radio-color-checked: sass.fn-naming-var("radio", "color", "checked");
|
|
16
|
+
$radio-color-hover: sass.fn-naming-var("radio", "color", "hover");
|
|
17
|
+
$radio-color-focus: sass.fn-naming-var("radio", "color", "focus");
|
|
18
|
+
$radio-color-disabled: sass.fn-naming-var("radio", "color", "disabled");
|
|
15
19
|
|
|
16
20
|
$radio-border-color-hover: sass.fn-naming-var("radio", "border-color", "hover");
|
|
17
21
|
$radio-border-color-focus: sass.fn-naming-var("radio", "border-color", "focus");
|
|
@@ -22,7 +26,9 @@ $radio-border-color-disabled: sass.fn-naming-var("radio", "border-color", "disab
|
|
|
22
26
|
$radio-box-shadow-color-focus: sass.fn-naming-var("radio", "box-shadow-color", "focus");
|
|
23
27
|
|
|
24
28
|
$transition-duration: sass.fn-naming-var("motion", "duration");
|
|
25
|
-
$
|
|
29
|
+
$radius-ratio: sass.fn-naming-var("radius-ratio");
|
|
30
|
+
|
|
31
|
+
$size-control-mark-size: sass.fn-naming-var("control-mark-size");
|
|
26
32
|
|
|
27
33
|
.#{$radio} {
|
|
28
34
|
display: inline-flex;
|
|
@@ -35,13 +41,13 @@ $border-radius: sass.fn-naming-var("border-radius");
|
|
|
35
41
|
|
|
36
42
|
.#{$radio-icon} {
|
|
37
43
|
flex-shrink: 0;
|
|
38
|
-
width:
|
|
39
|
-
height:
|
|
44
|
+
width: #{$size-control-mark-size};
|
|
45
|
+
height: #{$size-control-mark-size};
|
|
40
46
|
display: flex;
|
|
41
47
|
align-items: center;
|
|
42
48
|
justify-content: center;
|
|
43
|
-
border: 1px solid rgb(#{$radio-color});
|
|
44
49
|
background-color: transparent;
|
|
50
|
+
border: 1px solid transparent;
|
|
45
51
|
transition:
|
|
46
52
|
box-shadow #{$transition-duration} ease,
|
|
47
53
|
border-color #{$transition-duration} ease,
|
|
@@ -54,10 +60,10 @@ $border-radius: sass.fn-naming-var("border-radius");
|
|
|
54
60
|
|
|
55
61
|
&::after {
|
|
56
62
|
content: "";
|
|
57
|
-
width: 0.
|
|
58
|
-
height: 0.
|
|
63
|
+
width: calc(#{$size-control-mark-size} * 0.5);
|
|
64
|
+
height: calc(#{$size-control-mark-size} * 0.5);
|
|
59
65
|
border-radius: 50%;
|
|
60
|
-
background-color:
|
|
66
|
+
background-color: rgba(#{$radio-color-unchecked});
|
|
61
67
|
transform: scale(0);
|
|
62
68
|
transform-origin: center;
|
|
63
69
|
transition:
|
|
@@ -71,12 +77,12 @@ $border-radius: sass.fn-naming-var("border-radius");
|
|
|
71
77
|
&:not(.on) {
|
|
72
78
|
.#{$radio-icon} {
|
|
73
79
|
background-color: transparent;
|
|
74
|
-
border-color:
|
|
80
|
+
border-color: rgba(#{$radio-border-color-unchecked});
|
|
75
81
|
}
|
|
76
82
|
|
|
77
83
|
&:not(.disabled):not(.readonly):hover {
|
|
78
84
|
.#{$radio-icon} {
|
|
79
|
-
border-color:
|
|
85
|
+
border-color: rgba(#{$radio-border-color-hover});
|
|
80
86
|
}
|
|
81
87
|
}
|
|
82
88
|
}
|
|
@@ -84,22 +90,23 @@ $border-radius: sass.fn-naming-var("border-radius");
|
|
|
84
90
|
&.on {
|
|
85
91
|
&.fill {
|
|
86
92
|
.#{$radio-icon} {
|
|
87
|
-
background-color:
|
|
88
|
-
border-color:
|
|
93
|
+
background-color: rgba(#{$radio-background-color-checked});
|
|
94
|
+
border-color: rgba(#{$radio-border-color-checked});
|
|
89
95
|
|
|
90
96
|
&::after {
|
|
91
97
|
transform: scale(1);
|
|
98
|
+
background-color: rgba(#{$radio-color-checked});
|
|
92
99
|
}
|
|
93
100
|
}
|
|
94
101
|
}
|
|
95
102
|
|
|
96
103
|
&.outline {
|
|
97
104
|
.#{$radio-icon} {
|
|
98
|
-
border-color:
|
|
105
|
+
border-color: rgba(#{$radio-border-color-checked});
|
|
99
106
|
|
|
100
107
|
&::after {
|
|
101
108
|
transform: scale(1);
|
|
102
|
-
background-color:
|
|
109
|
+
background-color: rgba(#{$radio-background-color-checked});
|
|
103
110
|
}
|
|
104
111
|
}
|
|
105
112
|
}
|
|
@@ -111,8 +118,8 @@ $border-radius: sass.fn-naming-var("border-radius");
|
|
|
111
118
|
|
|
112
119
|
&.on {
|
|
113
120
|
.#{$radio-icon} {
|
|
114
|
-
background-color:
|
|
115
|
-
border-color:
|
|
121
|
+
background-color: rgba(#{$radio-background-color-disabled});
|
|
122
|
+
border-color: rgba(#{$radio-border-color-disabled});
|
|
116
123
|
}
|
|
117
124
|
}
|
|
118
125
|
}
|
|
@@ -124,12 +131,12 @@ $border-radius: sass.fn-naming-var("border-radius");
|
|
|
124
131
|
&.focus {
|
|
125
132
|
&.shadow {
|
|
126
133
|
.#{$radio-icon} {
|
|
127
|
-
box-shadow: 0 0 0 0.25rem
|
|
134
|
+
box-shadow: 0 0 0 0.25rem rgba(#{$radio-box-shadow-color-focus}, 0.25);
|
|
128
135
|
}
|
|
129
136
|
}
|
|
130
137
|
|
|
131
138
|
.#{$radio-icon} {
|
|
132
|
-
border-color:
|
|
139
|
+
border-color: rgba(#{$radio-border-color-focus});
|
|
133
140
|
}
|
|
134
141
|
}
|
|
135
142
|
}
|
|
@@ -1,9 +1,13 @@
|
|
|
1
|
+
import { AppSize } from "../../app";
|
|
2
|
+
|
|
1
3
|
export type RadioVariant = "fill" | "outline";
|
|
4
|
+
export type RadioSize = AppSize;
|
|
2
5
|
|
|
3
6
|
// Type definitions
|
|
4
7
|
export type RadioProps = {
|
|
5
8
|
value: string | number;
|
|
6
9
|
role?: string;
|
|
10
|
+
size?: RadioSize;
|
|
7
11
|
variant?: RadioVariant;
|
|
8
12
|
disabled?: boolean;
|
|
9
13
|
readonly?: boolean;
|
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
<script lang="ts" setup>
|
|
4
4
|
import { computed, inject, ref } from "vue";
|
|
5
5
|
import type { RadioProps } from "./radio.type";
|
|
6
|
-
import {
|
|
6
|
+
import { cssPrefix } from "../../../utils";
|
|
7
7
|
import { type AppProviderState, APP_PROVIDER_STATE_KEY } from "../../app";
|
|
8
8
|
import { type RadioGroupProviderState, RADIO_GROUP_PROVIDER_STATE_KEY } from "../radio-group";
|
|
9
9
|
|
|
@@ -11,6 +11,7 @@ import { type RadioGroupProviderState, RADIO_GROUP_PROVIDER_STATE_KEY } from "..
|
|
|
11
11
|
// ----------------------------------------------------------------------------
|
|
12
12
|
const props = withDefaults(defineProps<RadioProps>(), {
|
|
13
13
|
disabled: false,
|
|
14
|
+
size: "standard",
|
|
14
15
|
shadow: undefined,
|
|
15
16
|
});
|
|
16
17
|
const appState = inject<AppProviderState>(APP_PROVIDER_STATE_KEY);
|
|
@@ -41,9 +42,10 @@ const radioAttrs = computed(() => {
|
|
|
41
42
|
|
|
42
43
|
return {
|
|
43
44
|
class: [
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
45
|
+
cssPrefix(["layer", "radio"]),
|
|
46
|
+
cssPrefix(["role", role]),
|
|
47
|
+
cssPrefix(["size", props.size]),
|
|
48
|
+
cssPrefix("radio"),
|
|
47
49
|
variant,
|
|
48
50
|
{
|
|
49
51
|
on: isChecked,
|
|
@@ -57,7 +59,7 @@ const radioAttrs = computed(() => {
|
|
|
57
59
|
});
|
|
58
60
|
|
|
59
61
|
const radioIconAttrs = {
|
|
60
|
-
class: [
|
|
62
|
+
class: [cssPrefix("radio-icon")],
|
|
61
63
|
} as const;
|
|
62
64
|
|
|
63
65
|
// Methods
|
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
<script lang="ts" setup>
|
|
4
4
|
import { computed, inject, provide } from "vue";
|
|
5
5
|
import type { RadioGroupProps, RadioGroupEmit, RadioGroupProviderState } from "./radio-group.type";
|
|
6
|
-
import {
|
|
6
|
+
import { cssPrefix } from "../../../utils";
|
|
7
7
|
import { type AppProviderState, APP_PROVIDER_STATE_KEY } from "../../app";
|
|
8
8
|
import { RADIO_GROUP_PROVIDER_STATE_KEY } from "./radio-group.constants";
|
|
9
9
|
|
|
@@ -37,7 +37,7 @@ const shadow = computed(() => {
|
|
|
37
37
|
|
|
38
38
|
const radioGroupAttrs = computed(() => {
|
|
39
39
|
return {
|
|
40
|
-
class: [
|
|
40
|
+
class: [cssPrefix("radio-group"), props.direction],
|
|
41
41
|
};
|
|
42
42
|
});
|
|
43
43
|
|
|
@@ -1,6 +1,3 @@
|
|
|
1
|
-
<div v-bind="refresherAttrs" v-show="calculateOffset > 0">
|
|
2
|
-
<slot name="icon" :offset="calculateOffset" :refreshing="refreshing"></slot>
|
|
3
|
-
</div>
|
|
4
1
|
<div v-bind="containerAttrs" ref="container">
|
|
5
|
-
<slot></slot>
|
|
2
|
+
<slot :offset="calculateOffset" :refreshing="refreshing"></slot>
|
|
6
3
|
</div>
|
|
@@ -1,36 +1,18 @@
|
|
|
1
1
|
@use "@toife/sass-layer" as sass;
|
|
2
2
|
|
|
3
3
|
// Class
|
|
4
|
-
$
|
|
5
|
-
$container: sass.fn-naming-prefix("refresher-container");
|
|
6
|
-
|
|
7
|
-
// Variables
|
|
8
|
-
$safe-area-top: sass.fn-naming-var("safe-area", "top");
|
|
9
|
-
$transition-duration: sass.fn-naming-var("motion", "duration");
|
|
10
|
-
$offset: sass.fn-naming-var("refresher-offset");
|
|
4
|
+
$container: sass.fn-naming-prefix("refresher");
|
|
11
5
|
|
|
12
6
|
.#{$container} {
|
|
13
7
|
width: 100%;
|
|
14
8
|
height: 100%;
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
}
|
|
18
|
-
|
|
19
|
-
// Refresher
|
|
20
|
-
.#{$refresher} {
|
|
21
|
-
display: flex;
|
|
22
|
-
justify-content: center;
|
|
23
|
-
align-items: center;
|
|
24
|
-
overflow: hidden;
|
|
25
|
-
transition: height #{$transition-duration} ease;
|
|
9
|
+
max-width: 100%;
|
|
10
|
+
max-height: 100%;
|
|
26
11
|
position: absolute;
|
|
27
12
|
top: 0;
|
|
28
|
-
left:
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
&.moving {
|
|
34
|
-
top: calc(#{$safe-area-top} + #{$offset});
|
|
35
|
-
}
|
|
13
|
+
left: 0;
|
|
14
|
+
right: 0;
|
|
15
|
+
bottom: 0;
|
|
16
|
+
overflow: auto;
|
|
17
|
+
overscroll-behavior: none;
|
|
36
18
|
}
|
|
@@ -4,7 +4,7 @@
|
|
|
4
4
|
import { ref, onUnmounted, watch, computed } from "vue";
|
|
5
5
|
import { gesture } from "@toife/gesture";
|
|
6
6
|
import type { RefresherProps, RefresherEmit } from "./refresher.type";
|
|
7
|
-
import {
|
|
7
|
+
import { cssProperty, cssPrefix } from "../../utils";
|
|
8
8
|
|
|
9
9
|
// Component setup (props, emits, injects)
|
|
10
10
|
// ----------------------------------------------------------------------------
|
|
@@ -29,23 +29,9 @@ const calculateOffset = computed(() => {
|
|
|
29
29
|
return props.offset !== undefined ? props.offset : moveOffset.value / 2;
|
|
30
30
|
});
|
|
31
31
|
|
|
32
|
-
const refresherAttrs = computed(() => {
|
|
33
|
-
return {
|
|
34
|
-
style: {
|
|
35
|
-
[property("refresher-offset")]: `${calculateOffset.value}px`,
|
|
36
|
-
},
|
|
37
|
-
class: [
|
|
38
|
-
withPrefix("refresher"),
|
|
39
|
-
{
|
|
40
|
-
moving: calculateOffset.value > 0,
|
|
41
|
-
},
|
|
42
|
-
],
|
|
43
|
-
};
|
|
44
|
-
});
|
|
45
|
-
|
|
46
32
|
const containerAttrs = computed(() => {
|
|
47
33
|
return {
|
|
48
|
-
class: [
|
|
34
|
+
class: [cssPrefix("refresher")],
|
|
49
35
|
};
|
|
50
36
|
});
|
|
51
37
|
|
|
@@ -50,7 +50,7 @@ $backdrop-background-color: sass.fn-naming-var("backdrop", "background-color");
|
|
|
50
50
|
height: 100%;
|
|
51
51
|
top: 0;
|
|
52
52
|
left: 0;
|
|
53
|
-
background-color:
|
|
53
|
+
background-color: rgba(#{$backdrop-background-color});
|
|
54
54
|
opacity: calc(#{$backdrop-opacity} * (#{$backdrop-percent} / 100));
|
|
55
55
|
transition: opacity #{$transition-duration} ease;
|
|
56
56
|
}
|
|
@@ -64,7 +64,7 @@ $backdrop-background-color: sass.fn-naming-var("backdrop", "background-color");
|
|
|
64
64
|
top: 0;
|
|
65
65
|
left: 0;
|
|
66
66
|
flex: none;
|
|
67
|
-
background-color:
|
|
67
|
+
background-color: rgba(#{$background-color});
|
|
68
68
|
transform: translate(0, 0);
|
|
69
69
|
transition:
|
|
70
70
|
transform #{$transition-duration} ease,
|
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
<script lang="ts" setup>
|
|
4
4
|
import { computed, inject, onMounted, onUnmounted, reactive, ref, watch } from "vue";
|
|
5
5
|
import { gesture } from "@toife/gesture";
|
|
6
|
-
import {
|
|
6
|
+
import { cssPrefix, cssProperty } from "../../../utils";
|
|
7
7
|
import type {
|
|
8
8
|
RouteNavigatorEmit,
|
|
9
9
|
RouteNavigatorProps,
|
|
@@ -63,26 +63,26 @@ const navigatorAttrs = computed(() => {
|
|
|
63
63
|
}
|
|
64
64
|
|
|
65
65
|
return {
|
|
66
|
-
class: [
|
|
66
|
+
class: [cssPrefix("route-navigator"), props.direction, props.variant],
|
|
67
67
|
style: {
|
|
68
|
-
[
|
|
69
|
-
[
|
|
70
|
-
[
|
|
71
|
-
[
|
|
72
|
-
[
|
|
68
|
+
[cssProperty("route-navigator-transform-back")]: transform.back + "%",
|
|
69
|
+
[cssProperty("route-navigator-transform-prepare")]: transform.prepare + "%",
|
|
70
|
+
[cssProperty("route-navigator-transform-active")]: transform.active + "%",
|
|
71
|
+
[cssProperty("route-navigator-transition-duration")]: duration,
|
|
72
|
+
[cssProperty("route-navigator-backdrop-percent")]: transform.backdrop,
|
|
73
73
|
},
|
|
74
74
|
};
|
|
75
75
|
});
|
|
76
76
|
|
|
77
77
|
const componentAttrs = computed(() => {
|
|
78
78
|
return {
|
|
79
|
-
class: [
|
|
79
|
+
class: [cssPrefix("route-navigator-component"), props.direction],
|
|
80
80
|
};
|
|
81
81
|
});
|
|
82
82
|
|
|
83
83
|
const backdropAttrs = computed(() => {
|
|
84
84
|
return {
|
|
85
|
-
class: [
|
|
85
|
+
class: [cssPrefix("route-navigator-backdrop"), cssPrefix(["layer", "backdrop"])],
|
|
86
86
|
style: {
|
|
87
87
|
zIndex: backdropIndex.value * 2 - 1,
|
|
88
88
|
},
|
|
@@ -158,7 +158,7 @@ const goBack = () => {
|
|
|
158
158
|
if (activeIndex.value <= 0) return;
|
|
159
159
|
const prev = stack.value[activeIndex.value - 1];
|
|
160
160
|
if (!prev) return;
|
|
161
|
-
router.
|
|
161
|
+
router.back();
|
|
162
162
|
};
|
|
163
163
|
|
|
164
164
|
const resetTransform = () => {
|
|
@@ -230,7 +230,6 @@ onMounted(() => {
|
|
|
230
230
|
|
|
231
231
|
fast({ initialDirection, event }: { initialDirection: string; event: Event }) {
|
|
232
232
|
if (initialDirection !== props.direction) return;
|
|
233
|
-
event.preventDefault();
|
|
234
233
|
goBack();
|
|
235
234
|
},
|
|
236
235
|
|
|
@@ -246,7 +245,6 @@ onMounted(() => {
|
|
|
246
245
|
event: Event;
|
|
247
246
|
}) {
|
|
248
247
|
if (initialDirection !== props.direction) return;
|
|
249
|
-
event.preventDefault();
|
|
250
248
|
move({ deltaX, deltaY });
|
|
251
249
|
},
|
|
252
250
|
|
|
@@ -262,7 +260,6 @@ onMounted(() => {
|
|
|
262
260
|
event: Event;
|
|
263
261
|
}) {
|
|
264
262
|
if (initialDirection !== props.direction) return;
|
|
265
|
-
event.preventDefault();
|
|
266
263
|
up({ deltaX, deltaY });
|
|
267
264
|
},
|
|
268
265
|
|
|
@@ -1,16 +1,11 @@
|
|
|
1
1
|
import { shallowRef } from "vue";
|
|
2
2
|
import { type RouteComponent, type RouteLocationMatched } from "vue-router";
|
|
3
3
|
import { type RouteStack } from "../route.type";
|
|
4
|
-
import { RouteWrapperOption } from "./route-wrapper.type";
|
|
5
4
|
|
|
6
5
|
const stack = shallowRef<RouteStack[]>([]);
|
|
7
6
|
|
|
8
7
|
/** Recursively builds a nested stack from vue-router `matched` for the navigator. */
|
|
9
|
-
const buildTree = (
|
|
10
|
-
matched: RouteLocationMatched[],
|
|
11
|
-
current: RouteStack[],
|
|
12
|
-
option: RouteWrapperOption
|
|
13
|
-
) => {
|
|
8
|
+
const buildTree = (matched: RouteLocationMatched[], current: RouteStack[]) => {
|
|
14
9
|
if (matched.length === 0) return current;
|
|
15
10
|
|
|
16
11
|
// User navigated back: drop the leaf so we merge into the parent segment
|
|
@@ -25,11 +20,7 @@ const buildTree = (
|
|
|
25
20
|
current[current.length - 1].name === matched[0].name
|
|
26
21
|
) {
|
|
27
22
|
matched.shift();
|
|
28
|
-
current[current.length - 1].stack = buildTree(
|
|
29
|
-
matched,
|
|
30
|
-
current[current.length - 1].stack,
|
|
31
|
-
option
|
|
32
|
-
);
|
|
23
|
+
current[current.length - 1].stack = buildTree(matched, current[current.length - 1].stack);
|
|
33
24
|
}
|
|
34
25
|
// Push a new segment (forward navigation)
|
|
35
26
|
else {
|
|
@@ -39,8 +30,7 @@ const buildTree = (
|
|
|
39
30
|
current.push({
|
|
40
31
|
name,
|
|
41
32
|
component,
|
|
42
|
-
|
|
43
|
-
stack: buildTree(matched, [], option),
|
|
33
|
+
stack: buildTree(matched, []),
|
|
44
34
|
});
|
|
45
35
|
}
|
|
46
36
|
|
|
@@ -48,8 +38,8 @@ const buildTree = (
|
|
|
48
38
|
};
|
|
49
39
|
|
|
50
40
|
export const useRouteWrapper = () => {
|
|
51
|
-
const updateRoutes = (matched: RouteLocationMatched[]
|
|
52
|
-
stack.value = buildTree([...matched], [...stack.value]
|
|
41
|
+
const updateRoutes = (matched: RouteLocationMatched[]) => {
|
|
42
|
+
stack.value = buildTree([...matched], [...stack.value]);
|
|
53
43
|
};
|
|
54
44
|
|
|
55
45
|
return {
|
|
@@ -20,9 +20,7 @@ const router = useRouter();
|
|
|
20
20
|
watch(
|
|
21
21
|
() => route.matched,
|
|
22
22
|
() => {
|
|
23
|
-
updateRoutes(route.matched
|
|
24
|
-
fullPath: route.fullPath,
|
|
25
|
-
});
|
|
23
|
+
updateRoutes(route.matched);
|
|
26
24
|
}
|
|
27
25
|
);
|
|
28
26
|
|
|
@@ -31,22 +29,16 @@ onMounted(() => {
|
|
|
31
29
|
const homeName = props.homeRouteName;
|
|
32
30
|
|
|
33
31
|
if (route.name === homeName) {
|
|
34
|
-
updateRoutes(route.matched
|
|
35
|
-
fullPath: route.fullPath,
|
|
36
|
-
});
|
|
32
|
+
updateRoutes(route.matched);
|
|
37
33
|
} else {
|
|
38
34
|
const homeLocation = router.resolve({ name: homeName });
|
|
39
35
|
if (homeLocation.matched.length > 0) {
|
|
40
|
-
updateRoutes(homeLocation.matched
|
|
41
|
-
fullPath: homeLocation.fullPath,
|
|
42
|
-
});
|
|
36
|
+
updateRoutes(homeLocation.matched);
|
|
43
37
|
}
|
|
44
38
|
|
|
45
39
|
// Apply current route to stack
|
|
46
40
|
setTimeout(() => {
|
|
47
|
-
updateRoutes(route.matched
|
|
48
|
-
fullPath: route.fullPath,
|
|
49
|
-
});
|
|
41
|
+
updateRoutes(route.matched);
|
|
50
42
|
}, 50);
|
|
51
43
|
}
|
|
52
44
|
});
|
|
@@ -21,7 +21,7 @@ $app-color: sass.fn-naming-var("app", "color");
|
|
|
21
21
|
|
|
22
22
|
// Message
|
|
23
23
|
.#{$segmented-field-message} {
|
|
24
|
-
color:
|
|
24
|
+
color: rgba(#{$segmented-field-color});
|
|
25
25
|
font-size: 0.9em;
|
|
26
26
|
line-height: 1.5;
|
|
27
27
|
transition:
|
|
@@ -34,7 +34,7 @@ $app-color: sass.fn-naming-var("app", "color");
|
|
|
34
34
|
|
|
35
35
|
// Help
|
|
36
36
|
.#{$segmented-field-help} {
|
|
37
|
-
color:
|
|
37
|
+
color: rgba(#{$app-color}, 0.75);
|
|
38
38
|
font-size: 0.8em;
|
|
39
39
|
line-height: 1.5;
|
|
40
40
|
transition:
|
|
@@ -4,7 +4,7 @@
|
|
|
4
4
|
import { computed, inject, nextTick, ref } from "vue";
|
|
5
5
|
import { Field } from "../field";
|
|
6
6
|
import type { SegmentedFieldProps, SegmentedFieldEmit } from "./segmented-field.type";
|
|
7
|
-
import {
|
|
7
|
+
import { cssPrefix } from "../../utils";
|
|
8
8
|
import { type AppProviderState, APP_PROVIDER_STATE_KEY } from "../app";
|
|
9
9
|
|
|
10
10
|
// Component setup (props, emits, injects)
|
|
@@ -46,10 +46,10 @@ const wrapperAttrs = computed(() => {
|
|
|
46
46
|
const shape = props.shape || appState?.shape.value || "";
|
|
47
47
|
return {
|
|
48
48
|
class: [
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
49
|
+
cssPrefix("segmented-field-wrapper"),
|
|
50
|
+
cssPrefix(["layer", "segmented-field"]),
|
|
51
|
+
cssPrefix(["role", role]),
|
|
52
|
+
cssPrefix(["shape", shape]),
|
|
53
53
|
props.variant,
|
|
54
54
|
props.size,
|
|
55
55
|
{ disabled: props.disabled },
|
|
@@ -58,7 +58,7 @@ const wrapperAttrs = computed(() => {
|
|
|
58
58
|
});
|
|
59
59
|
|
|
60
60
|
const contentAttrs = {
|
|
61
|
-
class: [
|
|
61
|
+
class: [cssPrefix("segmented-field-content")],
|
|
62
62
|
} as const;
|
|
63
63
|
|
|
64
64
|
const fieldAttrs = computed(() => {
|
|
@@ -78,11 +78,11 @@ const fieldAttrs = computed(() => {
|
|
|
78
78
|
});
|
|
79
79
|
|
|
80
80
|
const messageAttrs = {
|
|
81
|
-
class: [
|
|
81
|
+
class: [cssPrefix("segmented-field-message")],
|
|
82
82
|
} as const;
|
|
83
83
|
|
|
84
84
|
const helpAttrs = {
|
|
85
|
-
class: [
|
|
85
|
+
class: [cssPrefix("segmented-field-help")],
|
|
86
86
|
} as const;
|
|
87
87
|
|
|
88
88
|
const nextIndex = computed(() => {
|
|
@@ -4,7 +4,7 @@
|
|
|
4
4
|
<Field
|
|
5
5
|
:role="role"
|
|
6
6
|
variant="outline"
|
|
7
|
-
@
|
|
7
|
+
@pointerup="toggle"
|
|
8
8
|
v-bind="fieldAttrs"
|
|
9
9
|
:class="{focus: isOpen}"
|
|
10
10
|
>
|
|
@@ -19,7 +19,7 @@
|
|
|
19
19
|
type="button"
|
|
20
20
|
:disabled="option.disabled"
|
|
21
21
|
v-bind="selectOptionAttrs"
|
|
22
|
-
@
|
|
22
|
+
@pointerup="pickOption(option)"
|
|
23
23
|
>
|
|
24
24
|
{{ option.label }}
|
|
25
25
|
</button>
|
|
@@ -42,8 +42,8 @@ $select-message-color: sass.fn-naming-var("select", "message-color");
|
|
|
42
42
|
width: 0.6rem;
|
|
43
43
|
height: 0.6rem;
|
|
44
44
|
border-radius: 0.1rem;
|
|
45
|
-
border-right: 2px solid
|
|
46
|
-
border-bottom: 2px solid
|
|
45
|
+
border-right: 2px solid rgba(var(--t-app-color));
|
|
46
|
+
border-bottom: 2px solid rgba(var(--t-app-color));
|
|
47
47
|
margin: calc(var(--t-spacing-y) * var(--t-coefficient-y))
|
|
48
48
|
calc(var(--t-spacing-x) * var(--t-coefficient-x));
|
|
49
49
|
transition: transform #{$transition-duration} ease;
|
|
@@ -68,8 +68,8 @@ $select-message-color: sass.fn-naming-var("select", "message-color");
|
|
|
68
68
|
overflow: hidden;
|
|
69
69
|
background: transparent;
|
|
70
70
|
cursor: pointer;
|
|
71
|
-
color:
|
|
72
|
-
background-color:
|
|
71
|
+
color: rgba(#{$select-color});
|
|
72
|
+
background-color: rgba(#{$select-background-color});
|
|
73
73
|
transition:
|
|
74
74
|
box-shadow #{$transition-duration} ease,
|
|
75
75
|
border-color #{$transition-duration} ease,
|
|
@@ -80,30 +80,30 @@ $select-message-color: sass.fn-naming-var("select", "message-color");
|
|
|
80
80
|
&:not(:disabled):not(.disabled):not(.readonly) {
|
|
81
81
|
&:hover,
|
|
82
82
|
&.hover {
|
|
83
|
-
background:
|
|
83
|
+
background: rgba(#{$select-background-color-hover});
|
|
84
84
|
}
|
|
85
85
|
|
|
86
86
|
&:focus,
|
|
87
87
|
&.focus {
|
|
88
|
-
background:
|
|
88
|
+
background: rgba(#{$select-background-color-focus});
|
|
89
89
|
}
|
|
90
90
|
|
|
91
91
|
&:active,
|
|
92
92
|
&.active {
|
|
93
|
-
background:
|
|
93
|
+
background: rgba(#{$select-background-color-active});
|
|
94
94
|
}
|
|
95
95
|
}
|
|
96
96
|
|
|
97
97
|
&:disabled,
|
|
98
98
|
&.disabled {
|
|
99
99
|
cursor: not-allowed;
|
|
100
|
-
color:
|
|
100
|
+
color: rgba(#{$select-color-disabled});
|
|
101
101
|
}
|
|
102
102
|
}
|
|
103
103
|
|
|
104
104
|
// Message
|
|
105
105
|
.#{$select-message} {
|
|
106
|
-
color:
|
|
106
|
+
color: rgba(#{$select-message-color});
|
|
107
107
|
font-size: 0.9em;
|
|
108
108
|
line-height: 1.5;
|
|
109
109
|
transition:
|
|
@@ -116,7 +116,7 @@ $select-message-color: sass.fn-naming-var("select", "message-color");
|
|
|
116
116
|
|
|
117
117
|
// Help
|
|
118
118
|
.#{$select-help} {
|
|
119
|
-
color:
|
|
119
|
+
color: rgba(#{$app-color}, 0.75);
|
|
120
120
|
font-size: 0.8em;
|
|
121
121
|
line-height: 1.5;
|
|
122
122
|
transition:
|