@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
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
<script lang="ts" setup>
|
|
4
4
|
import { computed, inject, ref } from "vue";
|
|
5
5
|
import type { CheckboxProps, CheckboxEmit } from "./checkbox.type";
|
|
6
|
-
import {
|
|
6
|
+
import { cssPrefix } from "../../utils";
|
|
7
7
|
import { type AppProviderState, APP_PROVIDER_STATE_KEY } from "../app";
|
|
8
8
|
|
|
9
9
|
// Component setup (props, emits, injects)
|
|
@@ -11,6 +11,7 @@ import { type AppProviderState, APP_PROVIDER_STATE_KEY } from "../app";
|
|
|
11
11
|
const props = withDefaults(defineProps<CheckboxProps>(), {
|
|
12
12
|
modelValue: false,
|
|
13
13
|
disabled: false,
|
|
14
|
+
size: "standard",
|
|
14
15
|
variant: "fill",
|
|
15
16
|
readonly: false,
|
|
16
17
|
shadow: undefined,
|
|
@@ -31,10 +32,11 @@ const checkboxAttrs = computed(() => {
|
|
|
31
32
|
const shadow = (props?.shadow !== undefined ? props.shadow : appState?.shadow.value) ?? false;
|
|
32
33
|
return {
|
|
33
34
|
class: [
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
35
|
+
cssPrefix(["layer", "checkbox"]),
|
|
36
|
+
cssPrefix(["role", role]),
|
|
37
|
+
cssPrefix(["shape", shape]),
|
|
38
|
+
cssPrefix(["size", props.size]),
|
|
39
|
+
cssPrefix("checkbox"),
|
|
38
40
|
props.variant,
|
|
39
41
|
{
|
|
40
42
|
on: props.modelValue,
|
|
@@ -48,7 +50,7 @@ const checkboxAttrs = computed(() => {
|
|
|
48
50
|
});
|
|
49
51
|
|
|
50
52
|
const checkboxIconAttrs = {
|
|
51
|
-
class: [
|
|
53
|
+
class: [cssPrefix("checkbox-icon")],
|
|
52
54
|
} as const;
|
|
53
55
|
|
|
54
56
|
// Methods
|
|
@@ -19,8 +19,8 @@ $transition-duration: sass.fn-naming-var("motion", "duration");
|
|
|
19
19
|
|
|
20
20
|
// Collapse
|
|
21
21
|
.#{$collapse} {
|
|
22
|
-
background-color:
|
|
23
|
-
color:
|
|
22
|
+
background-color: rgba(#{$collapse-background-color});
|
|
23
|
+
color: rgba(#{$collapse-color});
|
|
24
24
|
transition:
|
|
25
25
|
background-color #{$transition-duration} ease,
|
|
26
26
|
color #{$transition-duration} ease;
|
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
<script lang="ts" setup>
|
|
4
4
|
import { computed, inject, nextTick, onMounted, ref, watch } from "vue";
|
|
5
5
|
import type { CollapseEmit, CollapseProps } from "./collapse.type";
|
|
6
|
-
import {
|
|
6
|
+
import { cssPrefix, cssProperty } from "../../utils";
|
|
7
7
|
import { type AppProviderState, APP_PROVIDER_STATE_KEY } from "../app";
|
|
8
8
|
|
|
9
9
|
// Component setup (props, emits, injects)
|
|
@@ -36,9 +36,9 @@ const durationCss = computed(() =>
|
|
|
36
36
|
const wrapperAttrs = computed(() => {
|
|
37
37
|
return {
|
|
38
38
|
class: [
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
39
|
+
cssPrefix(["layer", "collapse"]),
|
|
40
|
+
cssPrefix(["role", role.value]),
|
|
41
|
+
cssPrefix("collapse"),
|
|
42
42
|
{
|
|
43
43
|
open: isOpen.value,
|
|
44
44
|
disabled: props.disabled,
|
|
@@ -49,7 +49,7 @@ const wrapperAttrs = computed(() => {
|
|
|
49
49
|
|
|
50
50
|
const triggerAttrs = computed(() => {
|
|
51
51
|
return {
|
|
52
|
-
class: [
|
|
52
|
+
class: [cssPrefix("collapse-trigger")],
|
|
53
53
|
"aria-expanded": isOpen.value,
|
|
54
54
|
"aria-disabled": props.disabled,
|
|
55
55
|
};
|
|
@@ -57,15 +57,15 @@ const triggerAttrs = computed(() => {
|
|
|
57
57
|
|
|
58
58
|
const contentAttrs = computed(() => {
|
|
59
59
|
return {
|
|
60
|
-
class: [
|
|
60
|
+
class: [cssPrefix("collapse-content")],
|
|
61
61
|
style: {
|
|
62
|
-
[
|
|
63
|
-
[
|
|
62
|
+
[cssProperty("collapse-duration")]: durationCss.value || undefined,
|
|
63
|
+
[cssProperty("collapse-height")]: isOpen.value ? `${contentHeight.value}px` : "0px",
|
|
64
64
|
},
|
|
65
65
|
};
|
|
66
66
|
});
|
|
67
67
|
|
|
68
|
-
const contentInnerClass = computed(() =>
|
|
68
|
+
const contentInnerClass = computed(() => cssPrefix("collapse-content-inner"));
|
|
69
69
|
|
|
70
70
|
// Methods
|
|
71
71
|
// ----------------------------------------------------------------------------
|
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
<style lang="scss" src="./container.scss" scoped></style>
|
|
2
2
|
<template src="./container.html"></template>
|
|
3
3
|
<script lang="ts" setup>
|
|
4
|
-
import {
|
|
4
|
+
import { cssPrefix } from "../../utils";
|
|
5
5
|
|
|
6
6
|
// Static layout wrapper classes
|
|
7
7
|
const containerAttrs = {
|
|
8
|
-
class: [
|
|
8
|
+
class: [cssPrefix("container")],
|
|
9
9
|
} as const;
|
|
10
10
|
</script>
|
|
@@ -9,11 +9,12 @@ $button: sass.fn-naming-prefix("button");
|
|
|
9
9
|
$shape-pill: sass.fn-naming-prefix("shape-pill");
|
|
10
10
|
|
|
11
11
|
// Property name - layer: decision-modal
|
|
12
|
-
$decision-modal-background-color: sass.fn-naming-var("
|
|
13
|
-
$decision-modal-border-color: sass.fn-naming-var("
|
|
14
|
-
$decision-modal-color: sass.fn-naming-var("
|
|
12
|
+
$decision-modal-background-color: sass.fn-naming-var("modal", "background-color");
|
|
13
|
+
$decision-modal-border-color: sass.fn-naming-var("modal", "border-color");
|
|
14
|
+
$decision-modal-color: sass.fn-naming-var("modal", "color");
|
|
15
15
|
|
|
16
|
-
$
|
|
16
|
+
$radius-ratio: sass.fn-naming-var("radius-ratio");
|
|
17
|
+
$radius-size: sass.fn-naming-var("radius-size");
|
|
17
18
|
$width: sass.fn-naming-var("viewport", "width");
|
|
18
19
|
$max-width: sass.fn-naming-var("overlay", "max-width");
|
|
19
20
|
$padding-y: sass.fn-naming-var("spacing", "y");
|
|
@@ -23,11 +24,12 @@ $margin-x: sass.fn-naming-var("spacing", "x");
|
|
|
23
24
|
$animation-duration: sass.fn-naming-var("motion", "duration");
|
|
24
25
|
$border-width: sass.fn-naming-var("stroke", "width");
|
|
25
26
|
$transition-duration: sass.fn-naming-var("motion", "duration");
|
|
27
|
+
$border-radius: calc(min(#{$width}, #{$radius-size}) * #{$radius-ratio});
|
|
26
28
|
|
|
27
29
|
.#{$decision-modal} {
|
|
28
30
|
// Styles
|
|
29
|
-
background-color:
|
|
30
|
-
color:
|
|
31
|
+
background-color: rgba(#{$decision-modal-background-color});
|
|
32
|
+
color: rgba(#{$decision-modal-color});
|
|
31
33
|
width: #{$width};
|
|
32
34
|
max-width: #{$max-width};
|
|
33
35
|
overflow: hidden;
|
|
@@ -49,7 +51,7 @@ $transition-duration: sass.fn-naming-var("motion", "duration");
|
|
|
49
51
|
align-items: center;
|
|
50
52
|
font-weight: 600;
|
|
51
53
|
border-bottom: #{$border-width} solid transparent;
|
|
52
|
-
color:
|
|
54
|
+
color: rgba(#{$decision-modal-color});
|
|
53
55
|
transition:
|
|
54
56
|
box-shadow #{$transition-duration} ease,
|
|
55
57
|
border-color #{$transition-duration} ease,
|
|
@@ -61,14 +63,14 @@ $transition-duration: sass.fn-naming-var("motion", "duration");
|
|
|
61
63
|
// Content of alert
|
|
62
64
|
.#{$decision-modal-body} {
|
|
63
65
|
padding: calc(#{$padding-y} * 4) calc(#{$padding-x} * 4);
|
|
64
|
-
color:
|
|
66
|
+
color: rgba(#{$decision-modal-color});
|
|
65
67
|
}
|
|
66
68
|
|
|
67
69
|
// Footer of alert
|
|
68
70
|
.#{$decision-modal-footer} {
|
|
69
71
|
display: flex;
|
|
70
72
|
border-top: #{$border-width} solid transparent;
|
|
71
|
-
color:
|
|
73
|
+
color: rgba(#{$decision-modal-color});
|
|
72
74
|
transition:
|
|
73
75
|
box-shadow #{$transition-duration} ease,
|
|
74
76
|
border-color #{$transition-duration} ease,
|
|
@@ -109,7 +111,7 @@ $transition-duration: sass.fn-naming-var("motion", "duration");
|
|
|
109
111
|
&.divider {
|
|
110
112
|
.#{$decision-modal-header},
|
|
111
113
|
.#{$decision-modal-footer} {
|
|
112
|
-
border-color:
|
|
114
|
+
border-color: rgba(#{$decision-modal-border-color});
|
|
113
115
|
}
|
|
114
116
|
}
|
|
115
117
|
|
|
@@ -9,7 +9,7 @@ import {
|
|
|
9
9
|
type DecisionModalButton,
|
|
10
10
|
type DecisionModalProps,
|
|
11
11
|
} from "./decision-modal.type";
|
|
12
|
-
import {
|
|
12
|
+
import { cssPrefix } from "../../utils";
|
|
13
13
|
import { type AppProviderState, APP_PROVIDER_STATE_KEY } from "../app";
|
|
14
14
|
|
|
15
15
|
// Component setup (props, emits, injects)
|
|
@@ -45,10 +45,10 @@ const decisionModalAttrs = computed(() => {
|
|
|
45
45
|
|
|
46
46
|
return {
|
|
47
47
|
class: [
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
48
|
+
cssPrefix(["layer", "modal"]),
|
|
49
|
+
cssPrefix(["role", role]),
|
|
50
|
+
cssPrefix(["shape", shape.value]),
|
|
51
|
+
cssPrefix("decision-modal"),
|
|
52
52
|
{
|
|
53
53
|
pop: pop.value,
|
|
54
54
|
divider: divider.value,
|
|
@@ -59,19 +59,19 @@ const decisionModalAttrs = computed(() => {
|
|
|
59
59
|
|
|
60
60
|
const decisionModalHeaderAttrs = computed(() => {
|
|
61
61
|
return {
|
|
62
|
-
class: [
|
|
62
|
+
class: [cssPrefix("decision-modal-header")],
|
|
63
63
|
};
|
|
64
64
|
});
|
|
65
65
|
|
|
66
66
|
const decisionModalBodyAttrs = computed(() => {
|
|
67
67
|
return {
|
|
68
|
-
class: [
|
|
68
|
+
class: [cssPrefix("decision-modal-body")],
|
|
69
69
|
};
|
|
70
70
|
});
|
|
71
71
|
|
|
72
72
|
const decisionModalFooterAttrs = computed(() => {
|
|
73
73
|
return {
|
|
74
|
-
class: [
|
|
74
|
+
class: [cssPrefix("decision-modal-footer"), `actions-flow-${props.flow}`],
|
|
75
75
|
};
|
|
76
76
|
});
|
|
77
77
|
|
|
@@ -19,11 +19,11 @@ $transition-duration: sass.fn-naming-var("motion", "duration");
|
|
|
19
19
|
|
|
20
20
|
&.horizontal {
|
|
21
21
|
width: 100%;
|
|
22
|
-
border-bottom: #{$border-width} solid
|
|
22
|
+
border-bottom: #{$border-width} solid rgba(#{$divider-border-color});
|
|
23
23
|
}
|
|
24
24
|
|
|
25
25
|
&.vertical {
|
|
26
26
|
height: 100%;
|
|
27
|
-
border-right: #{$border-width} solid
|
|
27
|
+
border-right: #{$border-width} solid rgba(#{$divider-border-color});
|
|
28
28
|
}
|
|
29
29
|
}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
<style lang="scss" src="./divider.scss" scoped></style>
|
|
2
2
|
<template src="./divider.html"></template>
|
|
3
3
|
<script lang="ts" setup>
|
|
4
|
-
import {
|
|
4
|
+
import { cssPrefix } from "../../utils";
|
|
5
5
|
import { type DividerProps } from "./divider.type";
|
|
6
6
|
import { computed, inject } from "vue";
|
|
7
7
|
import { type AppProviderState, APP_PROVIDER_STATE_KEY } from "../app";
|
|
@@ -19,9 +19,9 @@ const dividerAttrs = computed(() => {
|
|
|
19
19
|
const role = props.role || appState?.role.value || "";
|
|
20
20
|
return {
|
|
21
21
|
class: [
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
22
|
+
cssPrefix(["layer", "divider"]),
|
|
23
|
+
cssPrefix(["role", role]),
|
|
24
|
+
cssPrefix("divider"),
|
|
25
25
|
{
|
|
26
26
|
[props.direction]: true,
|
|
27
27
|
},
|
|
@@ -8,7 +8,7 @@ $dropdown-panel: sass.fn-naming-prefix("dropdown-panel");
|
|
|
8
8
|
$dropdown-border-color: sass.fn-naming-var("dropdown", "border-color");
|
|
9
9
|
$dropdown-background-color: sass.fn-naming-var("dropdown", "background-color");
|
|
10
10
|
$dropdown-color: sass.fn-naming-var("dropdown", "color");
|
|
11
|
-
$
|
|
11
|
+
$radius-ratio: sass.fn-naming-var("radius-ratio");
|
|
12
12
|
$border-width: sass.fn-naming-var("stroke", "width");
|
|
13
13
|
$spacing-x: sass.fn-naming-var("spacing", "x");
|
|
14
14
|
$spacing-y: sass.fn-naming-var("spacing", "y");
|
|
@@ -16,6 +16,9 @@ $size-font-size: sass.fn-naming-var("font-size");
|
|
|
16
16
|
$size-line-height: sass.fn-naming-var("line-height");
|
|
17
17
|
$transition-duration: sass.fn-naming-var("motion", "duration");
|
|
18
18
|
|
|
19
|
+
$size-control-block-size: sass.fn-naming-var("control-block-size");
|
|
20
|
+
$radius-size: sass.fn-naming-var("radius-size");
|
|
21
|
+
|
|
19
22
|
.#{$dropdown} {
|
|
20
23
|
position: relative;
|
|
21
24
|
display: block;
|
|
@@ -27,13 +30,13 @@ $transition-duration: sass.fn-naming-var("motion", "duration");
|
|
|
27
30
|
z-index: 20;
|
|
28
31
|
min-width: 100%;
|
|
29
32
|
box-sizing: border-box;
|
|
30
|
-
border-radius: #{$
|
|
33
|
+
border-radius: calc(min(#{$size-control-block-size}, #{$radius-size}) * #{$radius-ratio});
|
|
31
34
|
border-width: #{$border-width};
|
|
32
35
|
margin: #{$spacing-y} 0;
|
|
33
36
|
border-style: solid;
|
|
34
|
-
border-color:
|
|
35
|
-
background-color:
|
|
36
|
-
color:
|
|
37
|
+
border-color: rgba(#{$dropdown-border-color});
|
|
38
|
+
background-color: rgba(#{$dropdown-background-color});
|
|
39
|
+
color: rgba(#{$dropdown-color});
|
|
37
40
|
font-size: #{$size-font-size};
|
|
38
41
|
line-height: #{$size-line-height};
|
|
39
42
|
max-height: min(50vh, 16rem);
|
|
@@ -1,7 +1,9 @@
|
|
|
1
|
-
import type { AppDirection } from "../app";
|
|
1
|
+
import type { AppDirection, AppSize } from "../app";
|
|
2
2
|
|
|
3
3
|
export type DropdownPlacement = "bottom-start" | "bottom-end" | "top-start" | "top-end";
|
|
4
4
|
|
|
5
|
+
export type DropdownSize = AppSize;
|
|
6
|
+
|
|
5
7
|
export type DropdownProps = {
|
|
6
8
|
modelValue?: boolean;
|
|
7
9
|
disabled?: boolean;
|
|
@@ -10,6 +12,7 @@ export type DropdownProps = {
|
|
|
10
12
|
shadow?: boolean;
|
|
11
13
|
shape?: string;
|
|
12
14
|
direction?: AppDirection;
|
|
15
|
+
size?: DropdownSize;
|
|
13
16
|
};
|
|
14
17
|
|
|
15
18
|
export type DropdownEmit = {
|
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
<script lang="ts" setup>
|
|
4
4
|
import { computed, inject, onMounted, onUnmounted, ref, watch } from "vue";
|
|
5
5
|
import type { DropdownEmit, DropdownProps } from "./dropdown.type";
|
|
6
|
-
import {
|
|
6
|
+
import { cssPrefix } from "../../utils";
|
|
7
7
|
import { type AppProviderState, APP_PROVIDER_STATE_KEY } from "../app";
|
|
8
8
|
|
|
9
9
|
// Component setup (props, emits, injects)
|
|
@@ -16,6 +16,7 @@ const props = withDefaults(defineProps<DropdownProps>(), {
|
|
|
16
16
|
shadow: undefined,
|
|
17
17
|
shape: undefined,
|
|
18
18
|
direction: undefined,
|
|
19
|
+
size: "standard",
|
|
19
20
|
});
|
|
20
21
|
const emit = defineEmits<DropdownEmit>();
|
|
21
22
|
const appState = inject<AppProviderState>(APP_PROVIDER_STATE_KEY);
|
|
@@ -34,10 +35,11 @@ const wrapperAttrs = computed(() => {
|
|
|
34
35
|
|
|
35
36
|
return {
|
|
36
37
|
class: [
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
38
|
+
cssPrefix(["layer", "dropdown"]),
|
|
39
|
+
cssPrefix(["role", role]),
|
|
40
|
+
cssPrefix(["shape", shape]),
|
|
41
|
+
cssPrefix(["size", props.size]),
|
|
42
|
+
cssPrefix("dropdown"),
|
|
41
43
|
{
|
|
42
44
|
open: isOpen.value,
|
|
43
45
|
disabled: props.disabled,
|
|
@@ -49,7 +51,7 @@ const wrapperAttrs = computed(() => {
|
|
|
49
51
|
|
|
50
52
|
const panelAttrs = computed(() => {
|
|
51
53
|
return {
|
|
52
|
-
class: [
|
|
54
|
+
class: [cssPrefix("dropdown-panel"), props.placement],
|
|
53
55
|
};
|
|
54
56
|
});
|
|
55
57
|
|
|
@@ -1,13 +1,13 @@
|
|
|
1
|
-
import type { AppDirection } from "../app";
|
|
1
|
+
import type { AppDirection, AppSize } from "../app";
|
|
2
2
|
|
|
3
3
|
export type FieldVariant = "outline" | "fill" | "underline";
|
|
4
|
-
export type FieldSize =
|
|
4
|
+
export type FieldSize = AppSize;
|
|
5
5
|
export type FieldType = "text" | "number" | "email" | "password" | "tel" | "url" | "paragraph";
|
|
6
6
|
|
|
7
7
|
// Type definitions
|
|
8
8
|
export type FieldProps = {
|
|
9
9
|
// Wrapper
|
|
10
|
-
modelValue?: string;
|
|
10
|
+
modelValue?: string | number;
|
|
11
11
|
name?: string;
|
|
12
12
|
variant?: FieldVariant;
|
|
13
13
|
role?: string;
|
|
@@ -18,7 +18,7 @@ export type FieldProps = {
|
|
|
18
18
|
|
|
19
19
|
// Input
|
|
20
20
|
id?: string;
|
|
21
|
-
value?: string;
|
|
21
|
+
value?: string | number;
|
|
22
22
|
placeholder?: string;
|
|
23
23
|
disabled?: boolean;
|
|
24
24
|
readonly?: boolean;
|
|
@@ -11,18 +11,21 @@ $field-help: sass.fn-naming-prefix("field-help");
|
|
|
11
11
|
// Property name - layer: field
|
|
12
12
|
$field-border-color: sass.fn-naming-var("field", "border-color");
|
|
13
13
|
$field-background-color: sass.fn-naming-var("field", "background-color");
|
|
14
|
+
$field-color: sass.fn-naming-var("field", "color");
|
|
15
|
+
$field-placeholder-color: sass.fn-naming-var("field", "placeholder-color");
|
|
16
|
+
$field-help-color: sass.fn-naming-var("field", "help-color");
|
|
14
17
|
$field-line: sass.fn-naming-var("field", "line");
|
|
15
18
|
$field-max-line: sass.fn-naming-var("field", "max-line");
|
|
16
19
|
|
|
17
|
-
$
|
|
20
|
+
$radius-ratio: sass.fn-naming-var("radius-ratio");
|
|
21
|
+
$radius-size: sass.fn-naming-var("radius-size");
|
|
18
22
|
$border-width: sass.fn-naming-var("stroke", "width");
|
|
19
|
-
$app-color: sass.fn-naming-var("app", "color");
|
|
20
23
|
|
|
21
24
|
$spacing-x: sass.fn-naming-var("spacing", "x");
|
|
22
25
|
$spacing-y: sass.fn-naming-var("spacing", "y");
|
|
23
26
|
|
|
24
27
|
$size-font-size: sass.fn-naming-var("font-size");
|
|
25
|
-
$size-
|
|
28
|
+
$size-control-block-size: sass.fn-naming-var("control-block-size");
|
|
26
29
|
$size-coefficient-x: sass.fn-naming-var("coefficient-x");
|
|
27
30
|
$size-coefficient-y: sass.fn-naming-var("coefficient-y");
|
|
28
31
|
$size-line-height: sass.fn-naming-var("line-height");
|
|
@@ -44,8 +47,8 @@ $direction-justify-content: sass.fn-naming-var("justify-content");
|
|
|
44
47
|
background-color #{$transition-duration} ease,
|
|
45
48
|
color #{$transition-duration} ease,
|
|
46
49
|
border-radius #{$transition-duration} ease;
|
|
47
|
-
border-color:
|
|
48
|
-
border-radius: #{$
|
|
50
|
+
border-color: rgba(#{$field-border-color});
|
|
51
|
+
border-radius: calc(min(#{$size-control-block-size}, #{$radius-size}) * #{$radius-ratio});
|
|
49
52
|
border-width: #{$border-width};
|
|
50
53
|
border-style: solid;
|
|
51
54
|
overflow: hidden;
|
|
@@ -64,8 +67,8 @@ $direction-justify-content: sass.fn-naming-var("justify-content");
|
|
|
64
67
|
position: relative;
|
|
65
68
|
background-color: transparent;
|
|
66
69
|
z-index: 2;
|
|
67
|
-
min-height: calc(#{$field-line} * #{$size-
|
|
68
|
-
max-height: calc(#{$field-max-line} * #{$size-
|
|
70
|
+
min-height: calc(#{$field-line} * #{$size-control-block-size} - 2 * #{$border-width});
|
|
71
|
+
max-height: calc(#{$field-max-line} * #{$size-control-block-size} - 2 * #{$border-width});
|
|
69
72
|
box-sizing: border-box;
|
|
70
73
|
width: 100%;
|
|
71
74
|
flex: 1;
|
|
@@ -85,7 +88,7 @@ $direction-justify-content: sass.fn-naming-var("justify-content");
|
|
|
85
88
|
}
|
|
86
89
|
|
|
87
90
|
&::placeholder {
|
|
88
|
-
color: rgba(#{$
|
|
91
|
+
color: rgba(#{$field-placeholder-color});
|
|
89
92
|
}
|
|
90
93
|
}
|
|
91
94
|
|
|
@@ -96,13 +99,13 @@ $direction-justify-content: sass.fn-naming-var("justify-content");
|
|
|
96
99
|
position: relative;
|
|
97
100
|
background-color: transparent;
|
|
98
101
|
z-index: 2;
|
|
99
|
-
min-height: calc(#{$field-line} * #{$size-
|
|
100
|
-
max-height: calc(#{$field-max-line} * #{$size-
|
|
102
|
+
min-height: calc(#{$field-line} * #{$size-control-block-size} - 2 * #{$border-width});
|
|
103
|
+
max-height: calc(#{$field-max-line} * #{$size-control-block-size} - 2 * #{$border-width});
|
|
101
104
|
box-sizing: border-box;
|
|
102
105
|
width: 100%;
|
|
103
106
|
flex: 1;
|
|
104
|
-
color:
|
|
105
|
-
caret-color:
|
|
107
|
+
color: rgba(#{$field-color});
|
|
108
|
+
caret-color: rgba(#{$field-color});
|
|
106
109
|
border: none;
|
|
107
110
|
-webkit-user-select: text;
|
|
108
111
|
user-select: text;
|
|
@@ -135,7 +138,7 @@ $direction-justify-content: sass.fn-naming-var("justify-content");
|
|
|
135
138
|
}
|
|
136
139
|
|
|
137
140
|
&::placeholder {
|
|
138
|
-
color: rgba(#{$
|
|
141
|
+
color: rgba(#{$field-placeholder-color});
|
|
139
142
|
}
|
|
140
143
|
}
|
|
141
144
|
|
|
@@ -147,8 +150,8 @@ $direction-justify-content: sass.fn-naming-var("justify-content");
|
|
|
147
150
|
position: relative;
|
|
148
151
|
z-index: 2;
|
|
149
152
|
background-color: transparent;
|
|
150
|
-
color:
|
|
151
|
-
caret-color:
|
|
153
|
+
color: rgba(#{$field-color});
|
|
154
|
+
caret-color: rgba(#{$field-color});
|
|
152
155
|
border: none;
|
|
153
156
|
// user-select:all breaks caret placement on many mobile browsers for contenteditable.
|
|
154
157
|
-webkit-user-select: text;
|
|
@@ -169,7 +172,7 @@ $direction-justify-content: sass.fn-naming-var("justify-content");
|
|
|
169
172
|
|
|
170
173
|
// Message
|
|
171
174
|
.#{$field-message} {
|
|
172
|
-
color:
|
|
175
|
+
color: rgba(#{$field-background-color});
|
|
173
176
|
font-size: 0.9em;
|
|
174
177
|
line-height: 1.5;
|
|
175
178
|
transition:
|
|
@@ -182,7 +185,7 @@ $direction-justify-content: sass.fn-naming-var("justify-content");
|
|
|
182
185
|
|
|
183
186
|
// Help
|
|
184
187
|
.#{$field-help} {
|
|
185
|
-
color:
|
|
188
|
+
color: rgba(#{$field-help-color});
|
|
186
189
|
font-size: 0.8em;
|
|
187
190
|
line-height: 1.5;
|
|
188
191
|
transition:
|
|
@@ -196,13 +199,13 @@ $direction-justify-content: sass.fn-naming-var("justify-content");
|
|
|
196
199
|
&.focus {
|
|
197
200
|
&.shadow {
|
|
198
201
|
.#{$field-content} {
|
|
199
|
-
box-shadow: 0 0 0 0.25rem
|
|
202
|
+
box-shadow: 0 0 0 0.25rem rgba(#{$field-border-color}, 0.25);
|
|
200
203
|
}
|
|
201
204
|
}
|
|
202
205
|
|
|
203
206
|
&:not(.shadow) {
|
|
204
207
|
.#{$field-content} {
|
|
205
|
-
box-shadow: 0 0 0 calc(#{$border-width} * 1.5)
|
|
208
|
+
box-shadow: 0 0 0 calc(#{$border-width} * 1.5) rgba(#{$field-border-color});
|
|
206
209
|
}
|
|
207
210
|
}
|
|
208
211
|
}
|
|
@@ -223,10 +226,10 @@ $direction-justify-content: sass.fn-naming-var("justify-content");
|
|
|
223
226
|
div.#{$field-input} {
|
|
224
227
|
&::before {
|
|
225
228
|
content: attr(placeholder);
|
|
226
|
-
color: rgba(#{$
|
|
229
|
+
color: rgba(#{$field-placeholder-color});
|
|
227
230
|
transition: color #{$transition-duration} ease;
|
|
228
231
|
position: absolute;
|
|
229
|
-
height: calc(#{$size-
|
|
232
|
+
height: calc(#{$size-control-block-size} - #{$border-width} * 2);
|
|
230
233
|
box-sizing: border-box;
|
|
231
234
|
top: 0;
|
|
232
235
|
pointer-events: none;
|
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
<script lang="ts" setup>
|
|
4
4
|
import { computed, nextTick, onMounted, ref, watch } from "vue";
|
|
5
5
|
import type { FieldProps, FieldEmit } from "../field.type";
|
|
6
|
-
import {
|
|
6
|
+
import { cssProperty, cssPrefix } from "../../../utils";
|
|
7
7
|
|
|
8
8
|
// Component setup (props, emits, injects)
|
|
9
9
|
// ----------------------------------------------------------------------------
|
|
@@ -32,49 +32,57 @@ const isComposing = ref(false);
|
|
|
32
32
|
// Computed properties
|
|
33
33
|
// ----------------------------------------------------------------------------
|
|
34
34
|
const content = computed(() => {
|
|
35
|
-
|
|
35
|
+
if (props.value !== undefined && props.value !== null) {
|
|
36
|
+
return props.value;
|
|
37
|
+
}
|
|
38
|
+
return props.modelValue ?? "";
|
|
39
|
+
});
|
|
40
|
+
|
|
41
|
+
const isContentEmpty = computed(() => {
|
|
42
|
+
const v = content.value;
|
|
43
|
+
return v === "" || v === undefined || v === null;
|
|
36
44
|
});
|
|
37
45
|
|
|
38
46
|
const fieldAttrs = computed(() => {
|
|
39
47
|
return {
|
|
40
48
|
class: [
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
49
|
+
cssPrefix(["layer", "field"]),
|
|
50
|
+
cssPrefix(["role", props.role || ""]),
|
|
51
|
+
cssPrefix(["shape", props.shape || ""]),
|
|
52
|
+
cssPrefix("field"),
|
|
53
|
+
cssPrefix(["size", props.size]),
|
|
54
|
+
cssPrefix(["direction", props.direction || "left"]),
|
|
47
55
|
props.variant,
|
|
48
56
|
props.type,
|
|
49
57
|
{
|
|
50
58
|
disabled: props.disabled,
|
|
51
59
|
focus: isFocus.value,
|
|
52
60
|
shadow: props.shadow,
|
|
53
|
-
empty:
|
|
61
|
+
empty: isContentEmpty.value,
|
|
54
62
|
readonly: props.readonly,
|
|
55
63
|
typing: isComposing.value,
|
|
56
64
|
},
|
|
57
65
|
],
|
|
58
66
|
style: {
|
|
59
|
-
[
|
|
60
|
-
[
|
|
67
|
+
[cssProperty(["field", "line"])]: props.line,
|
|
68
|
+
[cssProperty(["field", "max-line"])]: props.maxLine || props.line,
|
|
61
69
|
},
|
|
62
70
|
};
|
|
63
71
|
});
|
|
64
72
|
|
|
65
73
|
const fieldContentAttrs = computed(() => ({
|
|
66
|
-
class: [
|
|
74
|
+
class: [cssPrefix("field-content")],
|
|
67
75
|
}));
|
|
68
76
|
|
|
69
77
|
/** Outer shell: layout, placeholder pseudo-element (must stay off the contenteditable node on iOS). */
|
|
70
78
|
const fieldInputShellAttrs = computed(() => ({
|
|
71
|
-
class: [
|
|
79
|
+
class: [cssPrefix("field-input")],
|
|
72
80
|
placeholder: props.placeholder,
|
|
73
81
|
}));
|
|
74
82
|
|
|
75
83
|
/** contenteditable as the literal string "true"|"false" improves mobile WebKit behavior vs boolean. */
|
|
76
84
|
const fieldEditableAttrs = computed(() => ({
|
|
77
|
-
class: [
|
|
85
|
+
class: [cssPrefix("field-input-editable")],
|
|
78
86
|
name: props.name,
|
|
79
87
|
id: props.id,
|
|
80
88
|
contenteditable:
|
|
@@ -84,7 +92,7 @@ const fieldEditableAttrs = computed(() => ({
|
|
|
84
92
|
}));
|
|
85
93
|
|
|
86
94
|
const fieldPasswordInputAttrs = computed(() => ({
|
|
87
|
-
class: [
|
|
95
|
+
class: [cssPrefix("field-input")],
|
|
88
96
|
name: props.name,
|
|
89
97
|
id: props.id,
|
|
90
98
|
placeholder: props.placeholder,
|
|
@@ -95,11 +103,11 @@ const fieldPasswordInputAttrs = computed(() => ({
|
|
|
95
103
|
}));
|
|
96
104
|
|
|
97
105
|
const fieldMessageAttrs = computed(() => ({
|
|
98
|
-
class: [
|
|
106
|
+
class: [cssPrefix("field-message")],
|
|
99
107
|
}));
|
|
100
108
|
|
|
101
109
|
const fieldHelpAttrs = computed(() => ({
|
|
102
|
-
class: [
|
|
110
|
+
class: [cssPrefix("field-help")],
|
|
103
111
|
}));
|
|
104
112
|
|
|
105
113
|
// Methods
|
|
@@ -235,7 +243,7 @@ const syncContentFromModel = async () => {
|
|
|
235
243
|
if (!el || props.type === "password") return;
|
|
236
244
|
if (isComposing.value) return;
|
|
237
245
|
|
|
238
|
-
const next = normalizeText(content.value ?? "");
|
|
246
|
+
const next = normalizeText(content.value.toString() ?? "");
|
|
239
247
|
const current = normalizeText(el.innerText);
|
|
240
248
|
if (current === next) return;
|
|
241
249
|
|