@toife/vue 3.0.6 → 3.1.2
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 +4 -2
- package/package.json +4 -8
- package/src/components/action/action.scss +1 -1
- package/src/components/app/app.scss +1 -1
- package/src/components/avatar/avatar.scss +1 -1
- package/src/components/button/button.scss +1 -1
- package/src/components/cable/cable.scss +1 -1
- package/src/components/card/card/card.scss +1 -1
- package/src/components/card/card/card.vue +1 -1
- package/src/components/card/card-body/card-body.scss +1 -1
- package/src/components/card/card-footer/card-footer.scss +1 -1
- package/src/components/card/card-header/card-header.scss +1 -1
- package/src/components/checkbox/checkbox.scss +1 -1
- package/src/components/collapse/collapse.scss +1 -1
- package/src/components/container/container.scss +1 -1
- package/src/components/decision-modal/decision-modal.scss +6 -1
- package/src/components/decision-modal/decision-modal.vue +3 -5
- package/src/components/divider/divider.scss +1 -1
- package/src/components/dropdown/dropdown.html +6 -0
- package/src/components/dropdown/dropdown.scss +68 -0
- package/src/components/dropdown/dropdown.type.ts +19 -0
- package/src/components/dropdown/dropdown.vue +109 -0
- package/src/components/dropdown/index.ts +2 -0
- package/src/components/field/field.html +12 -1
- package/src/components/field/outline/outline.html +29 -25
- package/src/components/field/outline/outline.scss +105 -52
- package/src/components/field/outline/outline.vue +59 -16
- package/src/components/form-group/form-group.scss +1 -1
- package/src/components/gesture-indicator/gesture-indicator.scss +1 -1
- package/src/components/index.ts +3 -0
- package/src/components/layout/cell/cell.html +1 -0
- package/src/components/layout/cell/cell.md +47 -0
- package/src/components/layout/cell/cell.scss +54 -0
- package/src/components/layout/cell/cell.type.ts +19 -0
- package/src/components/layout/cell/cell.vue +35 -0
- package/src/components/layout/cell/index.ts +2 -0
- package/src/components/layout/flex/flex.html +1 -0
- package/src/components/layout/flex/flex.scss +59 -0
- package/src/components/layout/flex/flex.type.ts +13 -0
- package/src/components/layout/flex/flex.vue +34 -0
- package/src/components/layout/flex/index.ts +2 -0
- package/src/components/layout/grid/grid.html +1 -0
- package/src/components/layout/grid/grid.md +50 -0
- package/src/components/layout/grid/grid.scss +53 -0
- package/src/components/layout/grid/grid.type.ts +12 -0
- package/src/components/layout/grid/grid.vue +32 -0
- package/src/components/layout/grid/index.ts +2 -0
- package/src/components/layout/index.ts +3 -0
- package/src/components/modal/modal.scss +1 -1
- package/src/components/page/page.scss +1 -1
- package/src/components/present/present.scss +1 -1
- package/src/components/radio/radio/radio.scss +1 -1
- package/src/components/radio/radio-group/radio-group.scss +1 -1
- package/src/components/refresher/refresher.scss +1 -1
- package/src/components/route/route-navigator/route-navigator.scss +5 -5
- package/src/components/route/route-navigator/route-navigator.vue +26 -20
- package/src/components/segmented-field/segmented-field.scss +1 -1
- package/src/components/select/index.ts +2 -0
- package/src/components/select/select.html +29 -0
- package/src/components/select/select.scss +129 -0
- package/src/components/select/select.type.ts +45 -0
- package/src/components/select/select.vue +119 -0
- package/src/components/skeleton/skeleton.scss +1 -1
- package/src/components/switch/switch.scss +1 -1
- package/src/components/tabs/tabs/tabs.scss +6 -6
- package/src/components/toast/toast/toast.scss +1 -1
- package/src/components/toast/toast-content/toast-content.scss +1 -1
- package/src/components/toolbar/toolbar.scss +1 -1
- package/src/factory.ts +10 -0
- package/src/utils/style/index.ts +1 -1
|
@@ -0,0 +1,119 @@
|
|
|
1
|
+
<style lang="scss" src="./select.scss" scoped></style>
|
|
2
|
+
<template src="./select.html"></template>
|
|
3
|
+
<script lang="ts" setup>
|
|
4
|
+
import { computed, inject, ref } from "vue";
|
|
5
|
+
import { type SelectOption, type SelectProps, type SelectEmit } from "./select.type";
|
|
6
|
+
import { property, withPrefix } from "../../utils";
|
|
7
|
+
import { type AppProviderState, APP_PROVIDER_STATE_KEY } from "../app";
|
|
8
|
+
import { Field } from "../field";
|
|
9
|
+
import { Dropdown } from "../dropdown";
|
|
10
|
+
|
|
11
|
+
// Component setup (props, emits, injects)
|
|
12
|
+
// ----------------------------------------------------------------------------
|
|
13
|
+
const props = withDefaults(defineProps<SelectProps>(), {
|
|
14
|
+
modelValue: "",
|
|
15
|
+
type: "text",
|
|
16
|
+
size: "standard",
|
|
17
|
+
disabled: false,
|
|
18
|
+
message: "",
|
|
19
|
+
help: "",
|
|
20
|
+
variant: "outline",
|
|
21
|
+
placeholder: "",
|
|
22
|
+
shadow: undefined,
|
|
23
|
+
direction: undefined,
|
|
24
|
+
options: () => [] as Array<SelectOption>,
|
|
25
|
+
});
|
|
26
|
+
const appState = inject<AppProviderState>(APP_PROVIDER_STATE_KEY);
|
|
27
|
+
const emit = defineEmits<SelectEmit>();
|
|
28
|
+
const visible = ref(false);
|
|
29
|
+
|
|
30
|
+
// Computed properties
|
|
31
|
+
// ----------------------------------------------------------------------------
|
|
32
|
+
const role = computed(() => {
|
|
33
|
+
return props.role || appState?.role.value || "";
|
|
34
|
+
});
|
|
35
|
+
|
|
36
|
+
const direction = computed(() => {
|
|
37
|
+
return props.direction || appState?.direction?.value || "left";
|
|
38
|
+
});
|
|
39
|
+
|
|
40
|
+
const shadow = computed(() => {
|
|
41
|
+
return props.shadow || appState?.shadow.value || false;
|
|
42
|
+
});
|
|
43
|
+
|
|
44
|
+
const shape = computed(() => {
|
|
45
|
+
return props.shape || appState?.shape.value || "";
|
|
46
|
+
});
|
|
47
|
+
|
|
48
|
+
const selectAttrs = computed(() => {
|
|
49
|
+
return {
|
|
50
|
+
class: [
|
|
51
|
+
withPrefix(["layer", "select"]),
|
|
52
|
+
withPrefix(["role", role.value]),
|
|
53
|
+
withPrefix("select"),
|
|
54
|
+
withPrefix(["direction", direction.value]),
|
|
55
|
+
withPrefix(["size", props.size]),
|
|
56
|
+
{
|
|
57
|
+
disabled: props.disabled,
|
|
58
|
+
},
|
|
59
|
+
],
|
|
60
|
+
};
|
|
61
|
+
});
|
|
62
|
+
|
|
63
|
+
const dropdownAttrs = computed(() => {
|
|
64
|
+
return {
|
|
65
|
+
role: role.value,
|
|
66
|
+
direction: direction.value,
|
|
67
|
+
shadow: shadow.value,
|
|
68
|
+
shape: shape.value,
|
|
69
|
+
disabled: props.disabled,
|
|
70
|
+
};
|
|
71
|
+
});
|
|
72
|
+
|
|
73
|
+
const fieldAttrs = computed(() => {
|
|
74
|
+
const propsValue = props.modelValue || props.value;
|
|
75
|
+
let val: string[] = [];
|
|
76
|
+
if (propsValue) val = typeof propsValue === "string" ? [propsValue] : (propsValue as string[]);
|
|
77
|
+
const values: string[] = props.options
|
|
78
|
+
.filter((option): option is SelectOption => (val || []).includes(option.value))
|
|
79
|
+
.map((option) => option.label ?? option.value);
|
|
80
|
+
|
|
81
|
+
return {
|
|
82
|
+
modelValue: values.join(","),
|
|
83
|
+
size: props.size,
|
|
84
|
+
variant: props.variant,
|
|
85
|
+
placeholder: props.placeholder,
|
|
86
|
+
direction: direction.value,
|
|
87
|
+
role: role.value,
|
|
88
|
+
shape: shape.value,
|
|
89
|
+
readonly: true,
|
|
90
|
+
disabled: props.disabled,
|
|
91
|
+
shadow: shadow.value,
|
|
92
|
+
};
|
|
93
|
+
});
|
|
94
|
+
|
|
95
|
+
const selectIconAttrs = computed(() => ({
|
|
96
|
+
class: [withPrefix("select-icon")],
|
|
97
|
+
}));
|
|
98
|
+
|
|
99
|
+
const selectOptionAttrs = computed(() => ({
|
|
100
|
+
class: [withPrefix("select-option")],
|
|
101
|
+
}));
|
|
102
|
+
|
|
103
|
+
const selectMessageAttrs = computed(() => ({
|
|
104
|
+
class: [withPrefix("select-message")],
|
|
105
|
+
}));
|
|
106
|
+
|
|
107
|
+
const selectHelpAttrs = computed(() => ({
|
|
108
|
+
class: [withPrefix("select-help")],
|
|
109
|
+
}));
|
|
110
|
+
|
|
111
|
+
// Methods
|
|
112
|
+
// ----------------------------------------------------------------------------
|
|
113
|
+
const pickOption = (option: SelectOption) => {
|
|
114
|
+
if (option.disabled || option.value === undefined) return;
|
|
115
|
+
emit("update:modelValue", option.value);
|
|
116
|
+
emit("select", option);
|
|
117
|
+
visible.value = false;
|
|
118
|
+
};
|
|
119
|
+
</script>
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
@use "@toife/sass-layer
|
|
1
|
+
@use "@toife/sass-layer" as sass;
|
|
2
2
|
|
|
3
3
|
// Class name
|
|
4
4
|
$tabs: sass.fn-naming-prefix("tabs");
|
|
@@ -30,7 +30,7 @@ $highlight-space-y: sass.fn-naming-var("highlight", "space-y");
|
|
|
30
30
|
position: relative;
|
|
31
31
|
margin: 0;
|
|
32
32
|
list-style: none;
|
|
33
|
-
border:
|
|
33
|
+
border: none;
|
|
34
34
|
transition:
|
|
35
35
|
box-shadow #{$transition-duration} ease,
|
|
36
36
|
border-color #{$transition-duration} ease,
|
|
@@ -113,25 +113,25 @@ $highlight-space-y: sass.fn-naming-var("highlight", "space-y");
|
|
|
113
113
|
&.top-start,
|
|
114
114
|
&.top-center,
|
|
115
115
|
&.top-end {
|
|
116
|
-
border-bottom
|
|
116
|
+
border-bottom: #{$border-width} solid rgb(#{$tabs-border-color});
|
|
117
117
|
}
|
|
118
118
|
|
|
119
119
|
&.bottom-start,
|
|
120
120
|
&.bottom-center,
|
|
121
121
|
&.bottom-end {
|
|
122
|
-
border-top
|
|
122
|
+
border-top: #{$border-width} solid rgb(#{$tabs-border-color});
|
|
123
123
|
}
|
|
124
124
|
|
|
125
125
|
&.left-start,
|
|
126
126
|
&.left-center,
|
|
127
127
|
&.left-end {
|
|
128
|
-
border-right
|
|
128
|
+
border-right: #{$border-width} solid rgb(#{$tabs-border-color});
|
|
129
129
|
}
|
|
130
130
|
|
|
131
131
|
&.right-start,
|
|
132
132
|
&.right-center,
|
|
133
133
|
&.right-end {
|
|
134
|
-
border-left
|
|
134
|
+
border-left: #{$border-width} solid rgb(#{$tabs-border-color});
|
|
135
135
|
}
|
|
136
136
|
}
|
|
137
137
|
|
package/src/factory.ts
CHANGED
|
@@ -13,9 +13,13 @@ import {
|
|
|
13
13
|
Container,
|
|
14
14
|
DecisionModal,
|
|
15
15
|
Divider,
|
|
16
|
+
Dropdown,
|
|
16
17
|
Field,
|
|
18
|
+
Flex,
|
|
17
19
|
FormGroup,
|
|
18
20
|
GestureIndicator,
|
|
21
|
+
Grid,
|
|
22
|
+
Cell,
|
|
19
23
|
Image,
|
|
20
24
|
Modal,
|
|
21
25
|
Page,
|
|
@@ -28,6 +32,7 @@ import {
|
|
|
28
32
|
RouteProvider,
|
|
29
33
|
RouteOutlet,
|
|
30
34
|
SegmentedField,
|
|
35
|
+
Select,
|
|
31
36
|
Skeleton,
|
|
32
37
|
Switch,
|
|
33
38
|
Tab,
|
|
@@ -59,9 +64,13 @@ export const createToife = (options?: CreateToifeOptions) => {
|
|
|
59
64
|
app.component(prefix + "container", Container);
|
|
60
65
|
app.component(prefix + "decision-modal", DecisionModal);
|
|
61
66
|
app.component(prefix + "divider", Divider);
|
|
67
|
+
app.component(prefix + "dropdown", Dropdown);
|
|
62
68
|
app.component(prefix + "field", Field);
|
|
69
|
+
app.component(prefix + "flex", Flex);
|
|
63
70
|
app.component(prefix + "form-group", FormGroup);
|
|
64
71
|
app.component(prefix + "gesture-indicator", GestureIndicator);
|
|
72
|
+
app.component(prefix + "grid", Grid);
|
|
73
|
+
app.component(prefix + "cell", Cell);
|
|
65
74
|
app.component(prefix + "image", Image);
|
|
66
75
|
app.component(prefix + "modal", Modal);
|
|
67
76
|
app.component(prefix + "page", Page);
|
|
@@ -72,6 +81,7 @@ export const createToife = (options?: CreateToifeOptions) => {
|
|
|
72
81
|
app.component(prefix + "route-provider", RouteProvider);
|
|
73
82
|
app.component(prefix + "route-outlet", RouteOutlet);
|
|
74
83
|
app.component(prefix + "segmented-field", SegmentedField);
|
|
84
|
+
app.component(prefix + "select", Select);
|
|
75
85
|
app.component(prefix + "skeleton", Skeleton);
|
|
76
86
|
app.component(prefix + "switch", Switch);
|
|
77
87
|
app.component(prefix + "tab", Tab);
|
package/src/utils/style/index.ts
CHANGED