@toife/vue 2.1.7 → 3.0.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/README.md +171 -0
- package/package.json +41 -9
- package/src/components/action/action.composable.ts +32 -0
- package/src/components/action/action.html +25 -0
- package/src/components/action/action.scss +106 -0
- package/src/components/action/action.type.ts +35 -0
- package/src/components/action/action.vue +82 -0
- package/src/components/action/index.ts +9 -0
- package/src/components/app/app.constants.ts +1 -0
- package/src/components/app/app.html +24 -0
- package/src/components/app/app.scss +27 -0
- package/src/components/app/app.type.ts +21 -0
- package/src/components/app/app.vue +45 -0
- package/src/components/app/index.ts +3 -0
- package/src/components/avatar/avatar.html +3 -0
- package/src/components/avatar/avatar.scss +35 -0
- package/src/components/avatar/avatar.type.ts +6 -0
- package/src/components/avatar/avatar.vue +45 -0
- package/src/components/avatar/index.ts +2 -0
- package/src/components/button/button.html +6 -0
- package/src/components/button/button.scss +113 -0
- package/src/components/button/button.type.ts +14 -0
- package/src/components/button/button.vue +66 -0
- package/src/components/button/index.ts +2 -0
- package/src/components/cable/cable.constants.ts +1 -0
- package/src/components/cable/cable.html +3 -0
- package/src/components/cable/cable.scss +37 -0
- package/src/components/cable/cable.type.ts +11 -0
- package/src/components/cable/cable.vue +33 -0
- package/src/components/cable/index.ts +3 -0
- package/src/components/card/card/card.constants.ts +1 -0
- package/src/components/card/card/card.html +3 -0
- package/src/components/card/card/card.scss +34 -0
- package/src/components/card/card/card.type.ts +14 -0
- package/src/components/card/card/card.vue +62 -0
- package/src/components/card/card/index.ts +3 -0
- package/src/components/card/card-body/card-body.html +3 -0
- package/src/components/card/card-body/card-body.scss +23 -0
- package/src/components/card/card-body/card-body.vue +14 -0
- package/src/components/card/card-body/index.ts +1 -0
- package/src/components/card/card-footer/card-footer.html +3 -0
- package/src/components/card/card-footer/card-footer.scss +31 -0
- package/src/components/card/card-footer/card-footer.vue +28 -0
- package/src/components/card/card-footer/index.ts +1 -0
- package/src/components/card/card-header/card-header.html +3 -0
- package/src/components/card/card-header/card-header.scss +31 -0
- package/src/components/card/card-header/card-header.vue +28 -0
- package/src/components/card/card-header/index.ts +1 -0
- package/src/components/card/index.ts +4 -0
- package/src/components/checkbox/checkbox.html +13 -0
- package/src/components/checkbox/checkbox.scss +138 -0
- package/src/components/checkbox/checkbox.type.ts +17 -0
- package/src/components/checkbox/checkbox.vue +91 -0
- package/src/components/checkbox/index.ts +2 -0
- package/src/components/collapse/collapse.html +16 -0
- package/src/components/collapse/collapse.scss +59 -0
- package/src/components/collapse/collapse.type.ts +11 -0
- package/src/components/collapse/collapse.vue +131 -0
- package/src/components/collapse/index.ts +2 -0
- package/src/components/container/container.html +1 -0
- package/src/components/container/container.scss +10 -0
- package/src/components/container/container.vue +14 -0
- package/src/components/container/index.ts +1 -0
- package/src/components/decision-modal/decision-modal.composable.ts +32 -0
- package/src/components/decision-modal/decision-modal.html +29 -0
- package/src/components/decision-modal/decision-modal.scss +136 -0
- package/src/components/decision-modal/decision-modal.type.ts +35 -0
- package/src/components/decision-modal/decision-modal.vue +98 -0
- package/src/components/decision-modal/index.ts +9 -0
- package/src/components/divider/divider.html +1 -0
- package/src/components/divider/divider.scss +29 -0
- package/src/components/divider/divider.type.ts +6 -0
- package/src/components/divider/divider.vue +34 -0
- package/src/components/divider/index.ts +2 -0
- package/src/components/field/field.html +1 -0
- package/src/components/field/field.type.ts +43 -0
- package/src/components/field/field.vue +85 -0
- package/src/components/field/index.ts +2 -0
- package/src/components/field/outline/index.ts +1 -0
- package/src/components/field/outline/outline.html +32 -0
- package/src/components/field/outline/outline.scss +224 -0
- package/src/components/field/outline/outline.vue +243 -0
- package/src/components/form-group/form-group.html +3 -0
- package/src/components/form-group/form-group.scss +91 -0
- package/src/components/form-group/form-group.type.ts +5 -0
- package/src/components/form-group/form-group.vue +21 -0
- package/src/components/form-group/index.ts +2 -0
- package/src/components/gesture-indicator/gesture-indicator.html +1 -0
- package/src/components/gesture-indicator/gesture-indicator.scss +45 -0
- package/src/components/gesture-indicator/gesture-indicator.type.ts +4 -0
- package/src/components/gesture-indicator/gesture-indicator.vue +32 -0
- package/src/components/gesture-indicator/index.ts +1 -0
- package/src/components/image/image.html +1 -0
- package/src/components/image/image.scss +1 -0
- package/src/components/image/image.type.ts +5 -0
- package/src/components/image/image.vue +25 -0
- package/src/components/image/index.ts +2 -0
- package/src/components/index.ts +27 -0
- package/src/components/modal/index.ts +2 -0
- package/src/components/modal/modal.html +20 -0
- package/src/components/modal/modal.scss +78 -0
- package/src/components/modal/modal.type.ts +21 -0
- package/src/components/modal/modal.vue +186 -0
- package/src/components/page/index.ts +1 -0
- package/src/components/page/page.html +3 -0
- package/src/components/page/page.scss +17 -0
- package/src/components/page/page.vue +14 -0
- package/src/components/present/index.ts +3 -0
- package/src/components/present/present.composable.ts +21 -0
- package/src/components/present/present.html +9 -0
- package/src/components/present/present.scss +81 -0
- package/src/components/present/present.type.ts +26 -0
- package/src/components/present/present.vue +198 -0
- package/src/components/radio/index.ts +2 -0
- package/src/components/radio/radio/index.ts +2 -0
- package/src/components/radio/radio/radio.html +11 -0
- package/src/components/radio/radio/radio.scss +125 -0
- package/src/components/radio/radio/radio.type.ts +11 -0
- package/src/components/radio/radio/radio.vue +103 -0
- package/src/components/radio/radio-group/index.ts +7 -0
- package/src/components/radio/radio-group/radio-group.constants.ts +1 -0
- package/src/components/radio/radio-group/radio-group.html +3 -0
- package/src/components/radio/radio-group/radio-group.scss +16 -0
- package/src/components/radio/radio-group/radio-group.type.ts +28 -0
- package/src/components/radio/radio-group/radio-group.vue +62 -0
- package/src/components/refresher/index.ts +2 -0
- package/src/components/refresher/refresher.html +6 -0
- package/src/components/refresher/refresher.scss +36 -0
- package/src/components/refresher/refresher.type.ts +16 -0
- package/src/components/refresher/refresher.vue +137 -0
- package/src/components/route/index.ts +5 -0
- package/src/components/route/route-navigator/index.ts +2 -0
- package/src/components/route/route-navigator/route-navigator.html +19 -0
- package/src/components/route/route-navigator/route-navigator.scss +127 -0
- package/src/components/route/route-navigator/route-navigator.type.ts +12 -0
- package/src/components/route/route-navigator/route-navigator.vue +250 -0
- package/src/components/route/route-outlet/index.ts +1 -0
- package/src/components/route/route-outlet/route-outlet.html +1 -0
- package/src/components/route/route-outlet/route-outlet.vue +30 -0
- package/src/components/route/route-provider/index.ts +3 -0
- package/src/components/route/route-provider/route-provider.constant.ts +1 -0
- package/src/components/route/route-provider/route-provider.html +1 -0
- package/src/components/route/route-provider/route-provider.type.ts +10 -0
- package/src/components/route/route-provider/route-provider.vue +20 -0
- package/src/components/route/route-wrapper/index.ts +3 -0
- package/src/components/route/route-wrapper/route-wrapper.composable.ts +43 -0
- package/src/components/route/route-wrapper/route-wrapper.html +3 -0
- package/src/components/route/route-wrapper/route-wrapper.type.ts +3 -0
- package/src/components/route/route-wrapper/route-wrapper.vue +43 -0
- package/src/components/route/route.type.ts +7 -0
- package/src/components/route/route.util.ts +8 -0
- package/src/components/segmented-field/index.ts +7 -0
- package/src/components/segmented-field/segmented-field.html +17 -0
- package/src/components/segmented-field/segmented-field.scss +52 -0
- package/src/components/segmented-field/segmented-field.type.ts +29 -0
- package/src/components/segmented-field/segmented-field.vue +151 -0
- package/src/components/skeleton/index.ts +2 -0
- package/src/components/skeleton/skeleton.html +1 -0
- package/src/components/skeleton/skeleton.scss +45 -0
- package/src/components/skeleton/skeleton.type.ts +7 -0
- package/src/components/skeleton/skeleton.vue +38 -0
- package/src/components/switch/index.ts +2 -0
- package/src/components/switch/switch.html +15 -0
- package/src/components/switch/switch.scss +134 -0
- package/src/components/switch/switch.type.ts +13 -0
- package/src/components/switch/switch.vue +92 -0
- package/src/components/tabs/index.ts +2 -0
- package/src/components/tabs/tab/index.ts +2 -0
- package/src/components/tabs/tab/tab.html +5 -0
- package/src/components/tabs/tab/tab.type.ts +5 -0
- package/src/components/tabs/tab/tab.vue +38 -0
- package/src/components/tabs/tabs/index.ts +9 -0
- package/src/components/tabs/tabs/tabs.constants.ts +1 -0
- package/src/components/tabs/tabs/tabs.html +3 -0
- package/src/components/tabs/tabs/tabs.scss +272 -0
- package/src/components/tabs/tabs/tabs.type.ts +36 -0
- package/src/components/tabs/tabs/tabs.vue +159 -0
- package/src/components/toast/index.ts +4 -0
- package/src/components/toast/toast/index.ts +1 -0
- package/src/components/toast/toast/toast.html +9 -0
- package/src/components/toast/toast/toast.scss +61 -0
- package/src/components/toast/toast/toast.vue +34 -0
- package/src/components/toast/toast-content/index.ts +1 -0
- package/src/components/toast/toast-content/toast-content.html +1 -0
- package/src/components/toast/toast-content/toast-content.scss +41 -0
- package/src/components/toast/toast-content/toast-content.vue +59 -0
- package/src/components/toast/toast.composable.ts +22 -0
- package/src/components/toast/toast.type.ts +25 -0
- package/src/components/toolbar/index.ts +2 -0
- package/src/components/toolbar/toolbar.html +5 -0
- package/src/components/toolbar/toolbar.scss +79 -0
- package/src/components/toolbar/toolbar.type.ts +7 -0
- package/src/components/toolbar/toolbar.vue +47 -0
- package/src/env.d.ts +7 -0
- package/src/factory.ts +81 -0
- package/src/index.ts +4 -0
- package/src/type.ts +3 -0
- package/src/utils/element.ts +16 -0
- package/src/utils/events.ts +12 -0
- package/src/utils/index.ts +3 -0
- package/src/utils/style/index.ts +42 -0
- package/dist/components/t-action.vue.d.ts +0 -29
- package/dist/components/t-alert.vue.d.ts +0 -35
- package/dist/components/t-app.vue.d.ts +0 -17
- package/dist/components/t-avatar.vue.d.ts +0 -24
- package/dist/components/t-back-button.vue.d.ts +0 -21
- package/dist/components/t-button.vue.d.ts +0 -36
- package/dist/components/t-cable.vue.d.ts +0 -24
- package/dist/components/t-card.vue.d.ts +0 -22
- package/dist/components/t-checkbox.vue.d.ts +0 -38
- package/dist/components/t-collapse.vue.d.ts +0 -32
- package/dist/components/t-content.vue.d.ts +0 -17
- package/dist/components/t-divider.vue.d.ts +0 -7
- package/dist/components/t-flex.vue.d.ts +0 -24
- package/dist/components/t-gesture-indicator.vue.d.ts +0 -7
- package/dist/components/t-grid.vue.d.ts +0 -24
- package/dist/components/t-icon-spinner.vue.d.ts +0 -23
- package/dist/components/t-image.vue.d.ts +0 -6
- package/dist/components/t-input.vue.d.ts +0 -47
- package/dist/components/t-keyboard-space.vue.d.ts +0 -2
- package/dist/components/t-loading.vue.d.ts +0 -29
- package/dist/components/t-present.vue.d.ts +0 -47
- package/dist/components/t-refresher.vue.d.ts +0 -43
- package/dist/components/t-rich-text.vue.d.ts +0 -2
- package/dist/components/t-ripple.vue.d.ts +0 -7
- package/dist/components/t-screen-router.vue.d.ts +0 -15
- package/dist/components/t-screen.vue.d.ts +0 -17
- package/dist/components/t-sheet.vue.d.ts +0 -251
- package/dist/components/t-skeleton.vue.d.ts +0 -13
- package/dist/components/t-switch.vue.d.ts +0 -12
- package/dist/components/t-tab.vue.d.ts +0 -23
- package/dist/components/t-tabs.vue.d.ts +0 -43
- package/dist/components/t-text.vue.d.ts +0 -24
- package/dist/components/t-textarea.vue.d.ts +0 -2
- package/dist/components/t-toast.vue.d.ts +0 -38
- package/dist/components/t-toggle-password.vue.d.ts +0 -31
- package/dist/components/t-toolbar.vue.d.ts +0 -26
- package/dist/controllers/action.d.ts +0 -4
- package/dist/controllers/alert.d.ts +0 -4
- package/dist/controllers/index.d.ts +0 -8
- package/dist/controllers/keyboard.d.ts +0 -3
- package/dist/controllers/loading.d.ts +0 -5
- package/dist/controllers/present.d.ts +0 -4
- package/dist/controllers/screen.d.ts +0 -20
- package/dist/controllers/toast.d.ts +0 -4
- package/dist/index.css +0 -1
- package/dist/index.d.ts +0 -5
- package/dist/index.es.js +0 -1501
- package/dist/index.umd.js +0 -1
- package/dist/utils/defaultEvent.d.ts +0 -2
- package/dist/utils/element.d.ts +0 -2
- package/dist/utils/index.d.ts +0 -1
|
@@ -0,0 +1,136 @@
|
|
|
1
|
+
@use "@toife/sass-layer-generator" as sass;
|
|
2
|
+
|
|
3
|
+
// Class name
|
|
4
|
+
$decision-modal: sass.fn-naming-prefix("decision-modal");
|
|
5
|
+
$decision-modal-header: sass.fn-naming-prefix("decision-modal-header");
|
|
6
|
+
$decision-modal-body: sass.fn-naming-prefix("decision-modal-body");
|
|
7
|
+
$decision-modal-footer: sass.fn-naming-prefix("decision-modal-footer");
|
|
8
|
+
$button: sass.fn-naming-prefix("button");
|
|
9
|
+
$shape-pill: sass.fn-naming-prefix("shape-pill");
|
|
10
|
+
|
|
11
|
+
// Property name - layer: surface
|
|
12
|
+
$border-radius: sass.fn-naming-var("border-radius");
|
|
13
|
+
$background-color: sass.fn-naming-var("surface", "background-color");
|
|
14
|
+
$width: sass.fn-naming-var("viewport", "width");
|
|
15
|
+
$max-width: sass.fn-naming-var("overlay", "max-width");
|
|
16
|
+
$padding-y: sass.fn-naming-var("spacing", "y");
|
|
17
|
+
$padding-x: sass.fn-naming-var("spacing", "x");
|
|
18
|
+
$margin-y: sass.fn-naming-var("spacing", "y");
|
|
19
|
+
$margin-x: sass.fn-naming-var("spacing", "x");
|
|
20
|
+
$animation-duration: sass.fn-naming-var("motion", "duration");
|
|
21
|
+
$border-width: sass.fn-naming-var("stroke", "width");
|
|
22
|
+
$border-color: sass.fn-naming-var("surface", "border-color");
|
|
23
|
+
$transition-duration: sass.fn-naming-var("motion", "duration");
|
|
24
|
+
|
|
25
|
+
.#{$decision-modal} {
|
|
26
|
+
// Styles
|
|
27
|
+
background-color: rgb(#{$background-color});
|
|
28
|
+
width: #{$width};
|
|
29
|
+
max-width: #{$max-width};
|
|
30
|
+
overflow: hidden;
|
|
31
|
+
position: relative;
|
|
32
|
+
margin: calc(#{$margin-x} * 4) calc(#{$margin-y} * 2);
|
|
33
|
+
border-radius: #{$border-radius};
|
|
34
|
+
transition:
|
|
35
|
+
box-shadow #{$transition-duration} ease,
|
|
36
|
+
border-color #{$transition-duration} ease,
|
|
37
|
+
background-color #{$transition-duration} ease,
|
|
38
|
+
color #{$transition-duration} ease,
|
|
39
|
+
border-radius #{$transition-duration} ease;
|
|
40
|
+
|
|
41
|
+
// Header of alert
|
|
42
|
+
.#{$decision-modal-header} {
|
|
43
|
+
padding: calc(#{$padding-y} * 4) calc(#{$padding-x} * 4);
|
|
44
|
+
display: flex;
|
|
45
|
+
justify-content: center;
|
|
46
|
+
align-items: center;
|
|
47
|
+
font-weight: 600;
|
|
48
|
+
border-bottom: #{$border-width} solid transparent;
|
|
49
|
+
transition:
|
|
50
|
+
box-shadow #{$transition-duration} ease,
|
|
51
|
+
border-color #{$transition-duration} ease,
|
|
52
|
+
background-color #{$transition-duration} ease,
|
|
53
|
+
color #{$transition-duration} ease,
|
|
54
|
+
border-radius #{$transition-duration} ease;
|
|
55
|
+
}
|
|
56
|
+
|
|
57
|
+
// Content of alert
|
|
58
|
+
.#{$decision-modal-body} {
|
|
59
|
+
padding: calc(#{$padding-y} * 4) calc(#{$padding-x} * 4);
|
|
60
|
+
}
|
|
61
|
+
|
|
62
|
+
// Footer of alert
|
|
63
|
+
.#{$decision-modal-footer} {
|
|
64
|
+
display: flex;
|
|
65
|
+
border-top: #{$border-width} solid transparent;
|
|
66
|
+
transition:
|
|
67
|
+
box-shadow #{$transition-duration} ease,
|
|
68
|
+
border-color #{$transition-duration} ease,
|
|
69
|
+
background-color #{$transition-duration} ease,
|
|
70
|
+
color #{$transition-duration} ease,
|
|
71
|
+
border-radius #{$transition-duration} ease;
|
|
72
|
+
|
|
73
|
+
> * {
|
|
74
|
+
flex: 1;
|
|
75
|
+
}
|
|
76
|
+
|
|
77
|
+
.#{$button} {
|
|
78
|
+
font-weight: 600;
|
|
79
|
+
border-radius: 0rem;
|
|
80
|
+
}
|
|
81
|
+
|
|
82
|
+
&.actions-flow-column {
|
|
83
|
+
flex-direction: column;
|
|
84
|
+
}
|
|
85
|
+
|
|
86
|
+
&.actions-flow-row {
|
|
87
|
+
flex-direction: row;
|
|
88
|
+
}
|
|
89
|
+
}
|
|
90
|
+
|
|
91
|
+
&.#{$shape-pill} {
|
|
92
|
+
.#{$decision-modal-footer} {
|
|
93
|
+
column-gap: #{$padding-x};
|
|
94
|
+
row-gap: #{$padding-y};
|
|
95
|
+
padding: calc(#{$padding-y} * 2) calc(#{$padding-x} * 2);
|
|
96
|
+
|
|
97
|
+
.#{$button} {
|
|
98
|
+
border-radius: #{$border-radius};
|
|
99
|
+
}
|
|
100
|
+
}
|
|
101
|
+
}
|
|
102
|
+
|
|
103
|
+
&.divider {
|
|
104
|
+
.#{$decision-modal-header},
|
|
105
|
+
.#{$decision-modal-footer} {
|
|
106
|
+
border-color: rgb(#{$border-color});
|
|
107
|
+
}
|
|
108
|
+
}
|
|
109
|
+
|
|
110
|
+
// Set effect with class
|
|
111
|
+
&.pop {
|
|
112
|
+
animation: pop #{$animation-duration} ease-in-out;
|
|
113
|
+
}
|
|
114
|
+
}
|
|
115
|
+
|
|
116
|
+
@keyframes pop {
|
|
117
|
+
0% {
|
|
118
|
+
transform: scale(1);
|
|
119
|
+
}
|
|
120
|
+
|
|
121
|
+
50% {
|
|
122
|
+
transform: scale(1.1);
|
|
123
|
+
}
|
|
124
|
+
|
|
125
|
+
70% {
|
|
126
|
+
transform: scale(1);
|
|
127
|
+
}
|
|
128
|
+
|
|
129
|
+
80% {
|
|
130
|
+
transform: scale(1.1);
|
|
131
|
+
}
|
|
132
|
+
|
|
133
|
+
100% {
|
|
134
|
+
transform: scale(1);
|
|
135
|
+
}
|
|
136
|
+
}
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
import { ButtonVariant } from "../button/button.type";
|
|
2
|
+
|
|
3
|
+
// Define
|
|
4
|
+
export type DecisionModalButton = {
|
|
5
|
+
text?: string;
|
|
6
|
+
role?: string;
|
|
7
|
+
variant?: ButtonVariant;
|
|
8
|
+
handler?: () => void;
|
|
9
|
+
data?: unknown;
|
|
10
|
+
};
|
|
11
|
+
|
|
12
|
+
export type DecisionModalFlow = "row" | "column";
|
|
13
|
+
|
|
14
|
+
export type DecisionModalProps = {
|
|
15
|
+
visible?: boolean;
|
|
16
|
+
title?: string;
|
|
17
|
+
message: string;
|
|
18
|
+
actions: DecisionModalButton[];
|
|
19
|
+
dismiss?: Array<string>;
|
|
20
|
+
placement?: string;
|
|
21
|
+
role?: string;
|
|
22
|
+
shape?: string;
|
|
23
|
+
divider?: boolean;
|
|
24
|
+
flow?: DecisionModalFlow;
|
|
25
|
+
};
|
|
26
|
+
|
|
27
|
+
export type DecisionModalComposableProps = DecisionModalProps & {
|
|
28
|
+
onClose?: (type?: string) => void;
|
|
29
|
+
onChoose?: (btn?: DecisionModalButton) => void;
|
|
30
|
+
};
|
|
31
|
+
|
|
32
|
+
export type DecisionModalEmit = {
|
|
33
|
+
(e: "close", type?: string): void;
|
|
34
|
+
(e: "choose", btn: DecisionModalButton): void;
|
|
35
|
+
};
|
|
@@ -0,0 +1,98 @@
|
|
|
1
|
+
<style lang="scss" src="./decision-modal.scss" scoped></style>
|
|
2
|
+
<template src="./decision-modal.html"></template>
|
|
3
|
+
<script lang="ts" setup>
|
|
4
|
+
import { computed, inject, ref } from "vue";
|
|
5
|
+
import { Present } from "../present";
|
|
6
|
+
import { Button as CustomButton } from "../button";
|
|
7
|
+
import {
|
|
8
|
+
type DecisionModalEmit,
|
|
9
|
+
type DecisionModalButton,
|
|
10
|
+
type DecisionModalProps,
|
|
11
|
+
} from "./decision-modal.type";
|
|
12
|
+
import { withPrefix } from "../../utils";
|
|
13
|
+
import { type AppProviderState, APP_PROVIDER_STATE_KEY } from "../app";
|
|
14
|
+
|
|
15
|
+
/// Define
|
|
16
|
+
/// ------------------------------------------------------------
|
|
17
|
+
const appState = inject<AppProviderState>(APP_PROVIDER_STATE_KEY);
|
|
18
|
+
const emit = defineEmits<DecisionModalEmit>();
|
|
19
|
+
const props = withDefaults(defineProps<DecisionModalProps>(), {
|
|
20
|
+
placement: "center",
|
|
21
|
+
keepalive: false,
|
|
22
|
+
visible: false,
|
|
23
|
+
shape: undefined,
|
|
24
|
+
role: undefined,
|
|
25
|
+
divider: undefined,
|
|
26
|
+
flow: "row",
|
|
27
|
+
});
|
|
28
|
+
|
|
29
|
+
/// State
|
|
30
|
+
/// ------------------------------------------------------------
|
|
31
|
+
const pop = ref(false);
|
|
32
|
+
|
|
33
|
+
/// Computed
|
|
34
|
+
/// ------------------------------------------------------------
|
|
35
|
+
const shape = computed(() => {
|
|
36
|
+
return props.shape || appState?.shape.value || "";
|
|
37
|
+
});
|
|
38
|
+
|
|
39
|
+
const role = computed(() => {
|
|
40
|
+
return props.role || appState?.role.value || "";
|
|
41
|
+
});
|
|
42
|
+
|
|
43
|
+
const divider = computed(() => {
|
|
44
|
+
return (props.divider !== undefined ? props.divider : appState?.divider.value) ?? false;
|
|
45
|
+
});
|
|
46
|
+
|
|
47
|
+
const decisionModalAttrs = computed(() => {
|
|
48
|
+
return {
|
|
49
|
+
class: [
|
|
50
|
+
withPrefix(["layer", "surface"]),
|
|
51
|
+
withPrefix(["role", role.value]),
|
|
52
|
+
withPrefix(["shape", shape.value]),
|
|
53
|
+
withPrefix("decision-modal"),
|
|
54
|
+
{
|
|
55
|
+
pop: pop.value,
|
|
56
|
+
divider: divider.value,
|
|
57
|
+
},
|
|
58
|
+
],
|
|
59
|
+
};
|
|
60
|
+
});
|
|
61
|
+
|
|
62
|
+
const decisionModalHeaderAttrs = computed(() => {
|
|
63
|
+
return {
|
|
64
|
+
class: [withPrefix("decision-modal-header")],
|
|
65
|
+
};
|
|
66
|
+
});
|
|
67
|
+
|
|
68
|
+
const decisionModalBodyAttrs = computed(() => {
|
|
69
|
+
return {
|
|
70
|
+
class: [withPrefix("decision-modal-body")],
|
|
71
|
+
};
|
|
72
|
+
});
|
|
73
|
+
|
|
74
|
+
const decisionModalFooterAttrs = computed(() => {
|
|
75
|
+
return {
|
|
76
|
+
class: [withPrefix("decision-modal-footer"), `actions-flow-${props.flow}`],
|
|
77
|
+
};
|
|
78
|
+
});
|
|
79
|
+
|
|
80
|
+
/// Methods
|
|
81
|
+
/// ------------------------------------------------------------
|
|
82
|
+
const onClose = (val: string) => {
|
|
83
|
+
if (props.dismiss && props.dismiss.includes(val)) {
|
|
84
|
+
emit("close", val);
|
|
85
|
+
} else if (val === "backdrop") {
|
|
86
|
+
pop.value = true;
|
|
87
|
+
setTimeout(() => {
|
|
88
|
+
pop.value = false;
|
|
89
|
+
}, 300);
|
|
90
|
+
}
|
|
91
|
+
};
|
|
92
|
+
|
|
93
|
+
const onChoose = (btn: DecisionModalButton) => {
|
|
94
|
+
emit("close");
|
|
95
|
+
btn.handler && btn.handler();
|
|
96
|
+
emit("choose", btn);
|
|
97
|
+
};
|
|
98
|
+
</script>
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
export { default as DecisionModal } from "./decision-modal.vue";
|
|
2
|
+
export type {
|
|
3
|
+
DecisionModalProps,
|
|
4
|
+
DecisionModalEmit,
|
|
5
|
+
DecisionModalButton,
|
|
6
|
+
DecisionModalComposableProps,
|
|
7
|
+
DecisionModalFlow,
|
|
8
|
+
} from "./decision-modal.type";
|
|
9
|
+
export { useDecisionModal } from "./decision-modal.composable";
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
<div v-bind="dividerAttrs"></div>
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
@use "@toife/sass-layer-generator" as sass;
|
|
2
|
+
|
|
3
|
+
// Class
|
|
4
|
+
$divider: sass.fn-naming-prefix("divider");
|
|
5
|
+
|
|
6
|
+
// Property - layer: stroke
|
|
7
|
+
$border-color: sass.fn-naming-var("stroke", "border-color");
|
|
8
|
+
$border-width: sass.fn-naming-var("stroke", "width");
|
|
9
|
+
$transition-duration: sass.fn-naming-var("motion", "duration");
|
|
10
|
+
|
|
11
|
+
// Divider
|
|
12
|
+
.#{$divider} {
|
|
13
|
+
transition:
|
|
14
|
+
border-radius #{$transition-duration} ease,
|
|
15
|
+
box-shadow #{$transition-duration} ease,
|
|
16
|
+
border-color #{$transition-duration} ease,
|
|
17
|
+
background-color #{$transition-duration} ease,
|
|
18
|
+
color #{$transition-duration} ease;
|
|
19
|
+
|
|
20
|
+
&.horizontal {
|
|
21
|
+
width: 100%;
|
|
22
|
+
border-bottom: #{$border-width} solid rgb(#{$border-color});
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
&.vertical {
|
|
26
|
+
height: 100%;
|
|
27
|
+
border-right: #{$border-width} solid rgb(#{$border-color});
|
|
28
|
+
}
|
|
29
|
+
}
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
<style lang="scss" src="./divider.scss" scoped></style>
|
|
2
|
+
<template src="./divider.html"></template>
|
|
3
|
+
<script lang="ts" setup>
|
|
4
|
+
import { withPrefix } from "../../utils";
|
|
5
|
+
import { type DividerProps } from "./divider.type";
|
|
6
|
+
import { computed, inject } from "vue";
|
|
7
|
+
import { type AppProviderState, APP_PROVIDER_STATE_KEY } from "../app";
|
|
8
|
+
|
|
9
|
+
/// Define
|
|
10
|
+
/// ------------------------------------------------------------
|
|
11
|
+
const props = withDefaults(defineProps<DividerProps>(), {
|
|
12
|
+
orientation: "horizontal",
|
|
13
|
+
});
|
|
14
|
+
const appState = inject<AppProviderState>(APP_PROVIDER_STATE_KEY);
|
|
15
|
+
|
|
16
|
+
/// Computed
|
|
17
|
+
/// ------------------------------------------------------------
|
|
18
|
+
const role = computed(() => {
|
|
19
|
+
return props.role || appState?.role.value || "";
|
|
20
|
+
});
|
|
21
|
+
|
|
22
|
+
const dividerAttrs = computed(() => {
|
|
23
|
+
return {
|
|
24
|
+
class: [
|
|
25
|
+
withPrefix(["layer", "stroke"]),
|
|
26
|
+
withPrefix(["role", role.value]),
|
|
27
|
+
withPrefix("divider"),
|
|
28
|
+
{
|
|
29
|
+
[props.orientation]: true,
|
|
30
|
+
},
|
|
31
|
+
],
|
|
32
|
+
};
|
|
33
|
+
});
|
|
34
|
+
</script>
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
<OutlineField v-if="props.variant === 'outline'" v-bind="fieldAttrs" />
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
import type { AppDirection } from "../app";
|
|
2
|
+
|
|
3
|
+
export type FieldVariant = "outline" | "fill" | "underline";
|
|
4
|
+
export type FieldSize = "small" | "standard" | "large";
|
|
5
|
+
export type FieldType = "text" | "number" | "email" | "password" | "tel" | "url" | "paragraph";
|
|
6
|
+
|
|
7
|
+
// Define
|
|
8
|
+
export type FieldProps = {
|
|
9
|
+
// Wrapper
|
|
10
|
+
modelValue?: string;
|
|
11
|
+
name?: string;
|
|
12
|
+
variant?: FieldVariant;
|
|
13
|
+
role?: string;
|
|
14
|
+
shape?: string;
|
|
15
|
+
size?: FieldSize;
|
|
16
|
+
shadow?: boolean;
|
|
17
|
+
direction?: AppDirection;
|
|
18
|
+
|
|
19
|
+
// Input
|
|
20
|
+
id?: string;
|
|
21
|
+
value?: string;
|
|
22
|
+
placeholder?: string;
|
|
23
|
+
disabled?: boolean;
|
|
24
|
+
readonly?: boolean;
|
|
25
|
+
autocomplete?: string;
|
|
26
|
+
maxLength?: number | string;
|
|
27
|
+
tabindex?: number | string;
|
|
28
|
+
type?: FieldType;
|
|
29
|
+
line?: number | string;
|
|
30
|
+
maxLine?: number | string;
|
|
31
|
+
|
|
32
|
+
// Support
|
|
33
|
+
message?: string;
|
|
34
|
+
help?: string;
|
|
35
|
+
};
|
|
36
|
+
|
|
37
|
+
export type FieldEmit = {
|
|
38
|
+
(e: "update:modelValue", value: string): void;
|
|
39
|
+
(e: "focus", ev: FocusEvent): void;
|
|
40
|
+
(e: "blur", ev: FocusEvent): void;
|
|
41
|
+
(e: "input", ev: Event): void;
|
|
42
|
+
(e: "beforeinput", ev: Event): void;
|
|
43
|
+
};
|
|
@@ -0,0 +1,85 @@
|
|
|
1
|
+
<template src="./field.html"></template>
|
|
2
|
+
<script lang="ts" setup>
|
|
3
|
+
import { computed, inject } from "vue";
|
|
4
|
+
import type { FieldProps } from "./field.type";
|
|
5
|
+
import type { FieldEmit } from "./field.type";
|
|
6
|
+
import { OutlineField } from "./outline";
|
|
7
|
+
import { type AppProviderState, APP_PROVIDER_STATE_KEY } from "../app";
|
|
8
|
+
|
|
9
|
+
/// Define
|
|
10
|
+
/// ------------------------------------------------------------
|
|
11
|
+
const props = withDefaults(defineProps<FieldProps>(), {
|
|
12
|
+
modelValue: "",
|
|
13
|
+
type: "text",
|
|
14
|
+
size: "standard",
|
|
15
|
+
disabled: false,
|
|
16
|
+
readonly: false,
|
|
17
|
+
message: "",
|
|
18
|
+
help: "",
|
|
19
|
+
variant: "outline",
|
|
20
|
+
placeholder: "",
|
|
21
|
+
shadow: undefined,
|
|
22
|
+
direction: undefined,
|
|
23
|
+
line: 1,
|
|
24
|
+
});
|
|
25
|
+
const emit = defineEmits<FieldEmit>();
|
|
26
|
+
const appState = inject<AppProviderState>(APP_PROVIDER_STATE_KEY);
|
|
27
|
+
|
|
28
|
+
/// Computed
|
|
29
|
+
/// ------------------------------------------------------------
|
|
30
|
+
const role = computed(() => {
|
|
31
|
+
return props.role || appState?.role.value || "";
|
|
32
|
+
});
|
|
33
|
+
|
|
34
|
+
const shape = computed(() => {
|
|
35
|
+
return props.shape || appState?.shape.value || "";
|
|
36
|
+
});
|
|
37
|
+
|
|
38
|
+
const shadow = computed(() => {
|
|
39
|
+
return (props?.shadow !== undefined ? props.shadow : appState?.shadow.value) ?? false;
|
|
40
|
+
});
|
|
41
|
+
|
|
42
|
+
const direction = computed(() => {
|
|
43
|
+
return props.direction || appState?.direction?.value || "left";
|
|
44
|
+
});
|
|
45
|
+
|
|
46
|
+
const fieldAttrs = computed(() => {
|
|
47
|
+
return {
|
|
48
|
+
...props,
|
|
49
|
+
direction: direction.value,
|
|
50
|
+
role: role.value,
|
|
51
|
+
shape: shape.value,
|
|
52
|
+
shadow: shadow.value,
|
|
53
|
+
onInput,
|
|
54
|
+
onFocus,
|
|
55
|
+
onBlur,
|
|
56
|
+
onBeforeinput,
|
|
57
|
+
};
|
|
58
|
+
});
|
|
59
|
+
|
|
60
|
+
/// Methods
|
|
61
|
+
/// ------------------------------------------------------------
|
|
62
|
+
const onInput = (event: Event) => {
|
|
63
|
+
let raw = "";
|
|
64
|
+
if (props.type !== "password") {
|
|
65
|
+
raw = (event.target as HTMLElement).innerText;
|
|
66
|
+
} else {
|
|
67
|
+
raw = (event.target as HTMLInputElement).value;
|
|
68
|
+
}
|
|
69
|
+
const value = raw.trim() === "" ? "" : raw;
|
|
70
|
+
emit("update:modelValue", value as string);
|
|
71
|
+
emit("input", event);
|
|
72
|
+
};
|
|
73
|
+
|
|
74
|
+
const onFocus = (event: FocusEvent) => {
|
|
75
|
+
emit("focus", event);
|
|
76
|
+
};
|
|
77
|
+
|
|
78
|
+
const onBlur = (event: FocusEvent) => {
|
|
79
|
+
emit("blur", event);
|
|
80
|
+
};
|
|
81
|
+
|
|
82
|
+
const onBeforeinput = (event: Event) => {
|
|
83
|
+
emit("beforeinput", event);
|
|
84
|
+
};
|
|
85
|
+
</script>
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { default as OutlineField } from "./outline.vue";
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
<div v-bind="fieldAttrs">
|
|
2
|
+
<div v-bind="fieldContentAttrs">
|
|
3
|
+
<div
|
|
4
|
+
v-bind="fieldInputAttrs"
|
|
5
|
+
@input="onInput"
|
|
6
|
+
@compositionstart="onCompositionStart"
|
|
7
|
+
@compositionend="onCompositionEnd"
|
|
8
|
+
@focus="onFocus"
|
|
9
|
+
@blur="onBlur"
|
|
10
|
+
@beforeinput="onBeforeinput"
|
|
11
|
+
ref="contentRef"
|
|
12
|
+
v-text="content"
|
|
13
|
+
v-if="type !== 'password'"
|
|
14
|
+
></div>
|
|
15
|
+
<input
|
|
16
|
+
v-bind="fieldInputAttrs"
|
|
17
|
+
@input="onInput"
|
|
18
|
+
@compositionstart="onCompositionStart"
|
|
19
|
+
@compositionend="onCompositionEnd"
|
|
20
|
+
@focus="onFocus"
|
|
21
|
+
@blur="onBlur"
|
|
22
|
+
@beforeinput="onBeforeinput"
|
|
23
|
+
ref="contentRef"
|
|
24
|
+
:value="content"
|
|
25
|
+
type="password"
|
|
26
|
+
v-else
|
|
27
|
+
></input>
|
|
28
|
+
</div>
|
|
29
|
+
<div v-bind="fieldMessageAttrs" v-if="message">{{ message }}</div>
|
|
30
|
+
<div v-bind="fieldHelpAttrs" v-if="help">{{ help }}</div>
|
|
31
|
+
<slot></slot>
|
|
32
|
+
</div>
|