@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,34 @@
|
|
|
1
|
+
<style lang="scss" src="./flex.scss" scoped></style>
|
|
2
|
+
<template src="./flex.html"></template>
|
|
3
|
+
<script lang="ts" setup>
|
|
4
|
+
import { computed } from "vue";
|
|
5
|
+
import { withPrefix, property } from "../../../utils";
|
|
6
|
+
import type { FlexProps } from "./flex.type";
|
|
7
|
+
|
|
8
|
+
// Component setup (props, emits, injects)
|
|
9
|
+
// ----------------------------------------------------------------------------
|
|
10
|
+
const props = withDefaults(defineProps<FlexProps>(), {
|
|
11
|
+
options: () => [],
|
|
12
|
+
});
|
|
13
|
+
|
|
14
|
+
// Computed properties
|
|
15
|
+
// ----------------------------------------------------------------------------
|
|
16
|
+
const flexAttrs = computed(() => {
|
|
17
|
+
const style = props.options.map((option) => {
|
|
18
|
+
return {
|
|
19
|
+
[property(["flex", "gap", option?.breakpoint || ""])]:
|
|
20
|
+
typeof option.gap === "number" ? `${option.gap}px` : option.gap,
|
|
21
|
+
[property(["flex", "direction", option?.breakpoint || ""])]: option.direction,
|
|
22
|
+
[property(["flex", "wrap", option?.breakpoint || ""])]: option.wrap,
|
|
23
|
+
[property(["flex", "justify", option?.breakpoint || ""])]: option.justify,
|
|
24
|
+
[property(["flex", "align", option?.breakpoint || ""])]: option.align,
|
|
25
|
+
[property(["flex", "align-content", option?.breakpoint || ""])]: option.alignContent,
|
|
26
|
+
};
|
|
27
|
+
});
|
|
28
|
+
|
|
29
|
+
return {
|
|
30
|
+
class: [withPrefix("flex")],
|
|
31
|
+
style,
|
|
32
|
+
};
|
|
33
|
+
});
|
|
34
|
+
</script>
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
<div v-bind="gridAttrs"><slot /></div>
|
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
# `<t-grid>`
|
|
2
|
+
|
|
3
|
+
> Default prefix is `t-` — change via `createToife({ prefix: "..." })`.
|
|
4
|
+
|
|
5
|
+
## Description
|
|
6
|
+
|
|
7
|
+
CSS Grid wrapper with theme-based default gap. Use with `<t-grid-item>` for placement.
|
|
8
|
+
|
|
9
|
+
## Requirements / dependencies
|
|
10
|
+
|
|
11
|
+
| Item | Notes |
|
|
12
|
+
| ------------------- | ------------------------------- |
|
|
13
|
+
| Vue | ^3.5 |
|
|
14
|
+
| `@toife/sass-layer` | Theme tokens for default `gap`. |
|
|
15
|
+
|
|
16
|
+
## Basic usage
|
|
17
|
+
|
|
18
|
+
```vue
|
|
19
|
+
<t-grid :columns="3">
|
|
20
|
+
<t-grid-item>One</t-grid-item>
|
|
21
|
+
<t-grid-item>Two</t-grid-item>
|
|
22
|
+
<t-grid-item>Three</t-grid-item>
|
|
23
|
+
</t-grid>
|
|
24
|
+
```
|
|
25
|
+
|
|
26
|
+
## Props
|
|
27
|
+
|
|
28
|
+
| Prop | Type | Default | Description |
|
|
29
|
+
| ---------------- | ------------------ | ------- | --------------------------------------------------------------- |
|
|
30
|
+
| `columns` | `number \| string` | `1` | Column count (`repeat(n, 1fr)`) or raw `grid-template-columns`. |
|
|
31
|
+
| `rows` | `number \| string` | — | `grid-template-rows`. |
|
|
32
|
+
| `gap` | `string` | — | Sets `gap` (overrides SCSS default when non-empty). |
|
|
33
|
+
| `columnGap` | `string` | — | `column-gap`. |
|
|
34
|
+
| `rowGap` | `string` | — | `row-gap`. |
|
|
35
|
+
| `alignItems` | `string` | — | `align-items`. |
|
|
36
|
+
| `justifyItems` | `string` | — | `justify-items`. |
|
|
37
|
+
| `alignContent` | `string` | — | `align-content`. |
|
|
38
|
+
| `justifyContent` | `string` | — | `justify-content`. |
|
|
39
|
+
| `autoFlow` | `string` | — | `grid-auto-flow`. |
|
|
40
|
+
|
|
41
|
+
## Slots
|
|
42
|
+
|
|
43
|
+
| Slot | Description |
|
|
44
|
+
| --------- | ----------- |
|
|
45
|
+
| `default` | Grid cells. |
|
|
46
|
+
|
|
47
|
+
## See also
|
|
48
|
+
|
|
49
|
+
- Source: `src/components/grid/grid`
|
|
50
|
+
- `<t-grid-item>`
|
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
@use "@toife/sass-layer" as sass;
|
|
2
|
+
@use "sass:map";
|
|
3
|
+
@use "sass:list";
|
|
4
|
+
|
|
5
|
+
/// Class name
|
|
6
|
+
$grid: sass.fn-naming-prefix("grid");
|
|
7
|
+
|
|
8
|
+
/// Base tokens (breakpoint "")
|
|
9
|
+
$grid-gap: sass.fn-naming-var("grid", "gap");
|
|
10
|
+
$grid-columns: sass.fn-naming-var("grid", "columns");
|
|
11
|
+
$grid-rows: sass.fn-naming-var("grid", "rows");
|
|
12
|
+
$grid-auto-flow: sass.fn-naming-var("grid", "auto-flow");
|
|
13
|
+
|
|
14
|
+
.#{$grid} {
|
|
15
|
+
display: grid;
|
|
16
|
+
box-sizing: border-box;
|
|
17
|
+
width: 100%;
|
|
18
|
+
min-height: 0;
|
|
19
|
+
gap: #{$grid-gap};
|
|
20
|
+
grid-template-columns: #{$grid-columns};
|
|
21
|
+
grid-template-rows: #{$grid-rows};
|
|
22
|
+
grid-auto-flow: #{$grid-auto-flow};
|
|
23
|
+
|
|
24
|
+
$bp-names: map.keys(sass.$breakpoints);
|
|
25
|
+
$bp-count: list.length($bp-names);
|
|
26
|
+
|
|
27
|
+
@for $i from 1 through $bp-count {
|
|
28
|
+
$bp-name: list.nth($bp-names, $i);
|
|
29
|
+
$bp-min: map.get(sass.$breakpoints, $bp-name);
|
|
30
|
+
|
|
31
|
+
@media (min-width: $bp-min) {
|
|
32
|
+
gap: #{sass.fn-naming-cascade-dvar(("grid", "gap"), $bp-names, $i, $grid-gap)};
|
|
33
|
+
grid-template-columns: #{sass.fn-naming-cascade-dvar(
|
|
34
|
+
("grid", "columns"),
|
|
35
|
+
$bp-names,
|
|
36
|
+
$i,
|
|
37
|
+
$grid-columns
|
|
38
|
+
)};
|
|
39
|
+
grid-template-rows: #{sass.fn-naming-cascade-dvar(
|
|
40
|
+
("grid", "rows"),
|
|
41
|
+
$bp-names,
|
|
42
|
+
$i,
|
|
43
|
+
$grid-rows
|
|
44
|
+
)};
|
|
45
|
+
grid-auto-flow: #{sass.fn-naming-cascade-dvar(
|
|
46
|
+
("grid", "auto-flow"),
|
|
47
|
+
$bp-names,
|
|
48
|
+
$i,
|
|
49
|
+
$grid-auto-flow
|
|
50
|
+
)};
|
|
51
|
+
}
|
|
52
|
+
}
|
|
53
|
+
}
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
<style lang="scss" src="./grid.scss" scoped></style>
|
|
2
|
+
<template src="./grid.html"></template>
|
|
3
|
+
<script lang="ts" setup>
|
|
4
|
+
import { computed } from "vue";
|
|
5
|
+
import { withPrefix, property } from "../../../utils";
|
|
6
|
+
import type { GridProps } from "./grid.type";
|
|
7
|
+
|
|
8
|
+
// Component setup (props, emits, injects)
|
|
9
|
+
// ----------------------------------------------------------------------------
|
|
10
|
+
const props = withDefaults(defineProps<GridProps>(), {
|
|
11
|
+
options: () => [],
|
|
12
|
+
});
|
|
13
|
+
|
|
14
|
+
// Computed properties
|
|
15
|
+
// ----------------------------------------------------------------------------
|
|
16
|
+
const gridAttrs = computed(() => {
|
|
17
|
+
const style = props.options.map((option) => {
|
|
18
|
+
return {
|
|
19
|
+
[property(["grid", "gap", option?.breakpoint || ""])]:
|
|
20
|
+
typeof option.gap === "number" ? `${option.gap}px` : option.gap,
|
|
21
|
+
[property(["grid", "columns", option?.breakpoint || ""])]: option.columns,
|
|
22
|
+
[property(["grid", "rows", option?.breakpoint || ""])]: option.rows,
|
|
23
|
+
[property(["grid", "auto-flow", option?.breakpoint || ""])]: option.autoFlow,
|
|
24
|
+
};
|
|
25
|
+
});
|
|
26
|
+
|
|
27
|
+
return {
|
|
28
|
+
class: [withPrefix("grid")],
|
|
29
|
+
style,
|
|
30
|
+
};
|
|
31
|
+
});
|
|
32
|
+
</script>
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
@use "@toife/sass-layer
|
|
1
|
+
@use "@toife/sass-layer" as sass;
|
|
2
2
|
|
|
3
3
|
// Classes
|
|
4
4
|
$navigator: sass.fn-naming-prefix("route-navigator");
|
|
@@ -108,19 +108,19 @@ $backdrop-background-color: sass.fn-naming-var("backdrop", "background-color");
|
|
|
108
108
|
|
|
109
109
|
&.back {
|
|
110
110
|
&.right {
|
|
111
|
-
transform: translateX(
|
|
111
|
+
transform: translateX(#{$transform-back});
|
|
112
112
|
}
|
|
113
113
|
|
|
114
114
|
&.left {
|
|
115
|
-
transform: translateX(#{$transform-back});
|
|
115
|
+
transform: translateX(calc(-1 * #{$transform-back}));
|
|
116
116
|
}
|
|
117
117
|
|
|
118
118
|
&.up {
|
|
119
|
-
transform: translateY(#{$transform-back});
|
|
119
|
+
transform: translateY(calc(-1 * #{$transform-back}));
|
|
120
120
|
}
|
|
121
121
|
|
|
122
122
|
&.down {
|
|
123
|
-
transform: translateY(
|
|
123
|
+
transform: translateY(#{$transform-back});
|
|
124
124
|
}
|
|
125
125
|
}
|
|
126
126
|
}
|
|
@@ -26,7 +26,7 @@ import { clone } from "../route.util";
|
|
|
26
26
|
// Active uses 0–100%; back uses (peek)*(100−percent)/100, so a peek of 40 makes the
|
|
27
27
|
// back layer move 2.5× slower than the active layer (parallax). Use 100 for 1:1 motion
|
|
28
28
|
// (no edge peek at rest: back starts at -100%).
|
|
29
|
-
const BACK_LAYER_PEEK_PCT = 40;
|
|
29
|
+
const BACK_LAYER_PEEK_PCT = -40;
|
|
30
30
|
|
|
31
31
|
const props = withDefaults(defineProps<RouteNavigatorProps>(), {
|
|
32
32
|
direction: "right",
|
|
@@ -134,17 +134,23 @@ const changeRoute = (value: RouteStack[]) => {
|
|
|
134
134
|
transform.backdrop = 0;
|
|
135
135
|
emit("transform", transform);
|
|
136
136
|
|
|
137
|
-
setTimeout(
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
137
|
+
setTimeout(
|
|
138
|
+
() => {
|
|
139
|
+
backdropIndex.value = backdropIndex.value + 1;
|
|
140
|
+
transform.duration = undefined;
|
|
141
|
+
emit("transform", transform);
|
|
142
|
+
},
|
|
143
|
+
props.variant === "swipe" ? 10 : 0
|
|
144
|
+
);
|
|
145
|
+
|
|
146
|
+
setTimeout(
|
|
147
|
+
() => {
|
|
148
|
+
transform.backdrop = 100;
|
|
149
|
+
activeIndex.value = stack.value.length - 1;
|
|
150
|
+
emit("transform", transform);
|
|
151
|
+
},
|
|
152
|
+
props.variant === "swipe" ? 100 : 0
|
|
153
|
+
);
|
|
148
154
|
}
|
|
149
155
|
};
|
|
150
156
|
|
|
@@ -159,23 +165,24 @@ const resetTransform = () => {
|
|
|
159
165
|
transform.back = BACK_LAYER_PEEK_PCT;
|
|
160
166
|
transform.prepare = 100;
|
|
161
167
|
transform.active = 0;
|
|
162
|
-
|
|
168
|
+
transform.duration = undefined;
|
|
163
169
|
emit("transform", transform);
|
|
164
170
|
};
|
|
165
171
|
|
|
166
172
|
const move = (data: RouteNavigatorGesture) => {
|
|
167
173
|
const width = navigatorRef.value?.offsetWidth ?? 0;
|
|
168
|
-
let
|
|
174
|
+
let activePercent = 0;
|
|
169
175
|
|
|
170
176
|
if (props.direction == "left" || props.direction == "right") {
|
|
171
|
-
|
|
177
|
+
activePercent = (Math.abs(data.deltaX) / width) * 100;
|
|
172
178
|
} else {
|
|
173
|
-
|
|
179
|
+
activePercent = (Math.abs(data.deltaY) / width) * 100;
|
|
174
180
|
}
|
|
175
181
|
|
|
176
|
-
transform.back = ((100 -
|
|
177
|
-
transform.active =
|
|
182
|
+
transform.back = ((100 - activePercent) * BACK_LAYER_PEEK_PCT) / 100;
|
|
183
|
+
transform.active = activePercent;
|
|
178
184
|
transform.backdrop = 100 - transform.active;
|
|
185
|
+
transform.duration = "0s";
|
|
179
186
|
|
|
180
187
|
emit("transform", transform);
|
|
181
188
|
};
|
|
@@ -216,14 +223,13 @@ onMounted(() => {
|
|
|
216
223
|
beforeEvent(e: Event) {
|
|
217
224
|
const target = e.target as HTMLElement | null;
|
|
218
225
|
const isEditable = target?.closest("input, textarea, select, button, [contenteditable]");
|
|
219
|
-
if (isEditable || props.variant === "none") return false;
|
|
226
|
+
if (isEditable || props.variant === "none" || !prevPage.value) return false;
|
|
220
227
|
e.stopPropagation();
|
|
221
228
|
return prevPage.value;
|
|
222
229
|
},
|
|
223
230
|
|
|
224
231
|
fast({ initialDirection, event }: { initialDirection: string; event: Event }) {
|
|
225
232
|
if (initialDirection !== props.direction) return;
|
|
226
|
-
event.stopPropagation();
|
|
227
233
|
event.preventDefault();
|
|
228
234
|
goBack();
|
|
229
235
|
},
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
<div v-bind="selectAttrs">
|
|
2
|
+
<Dropdown v-bind="dropdownAttrs" v-model="visible">
|
|
3
|
+
<template #trigger="{ toggle, isOpen }">
|
|
4
|
+
<Field
|
|
5
|
+
:role="role"
|
|
6
|
+
variant="outline"
|
|
7
|
+
@click="toggle"
|
|
8
|
+
v-bind="fieldAttrs"
|
|
9
|
+
:class="{focus: isOpen}"
|
|
10
|
+
>
|
|
11
|
+
<template #end-input>
|
|
12
|
+
<span v-bind="selectIconAttrs" :class="{open: isOpen}"></span>
|
|
13
|
+
</template>
|
|
14
|
+
</Field>
|
|
15
|
+
</template>
|
|
16
|
+
<button
|
|
17
|
+
v-for="option in options"
|
|
18
|
+
:key="option.value"
|
|
19
|
+
type="button"
|
|
20
|
+
:disabled="option.disabled"
|
|
21
|
+
v-bind="selectOptionAttrs"
|
|
22
|
+
@click="pickOption(option)"
|
|
23
|
+
>
|
|
24
|
+
{{ option.label }}
|
|
25
|
+
</button>
|
|
26
|
+
</Dropdown>
|
|
27
|
+
<div v-bind="selectMessageAttrs" v-if="message">{{ message }}</div>
|
|
28
|
+
<div v-bind="selectHelpAttrs" v-if="help">{{ help }}</div>
|
|
29
|
+
</div>
|
|
@@ -0,0 +1,129 @@
|
|
|
1
|
+
@use "@toife/sass-layer" as sass;
|
|
2
|
+
|
|
3
|
+
// Class name
|
|
4
|
+
$select: sass.fn-naming-prefix("select");
|
|
5
|
+
$select-icon: sass.fn-naming-prefix("select-icon");
|
|
6
|
+
$select-option: sass.fn-naming-prefix("select-option");
|
|
7
|
+
$select-message: sass.fn-naming-prefix("select-message");
|
|
8
|
+
$select-help: sass.fn-naming-prefix("select-help");
|
|
9
|
+
$field: sass.fn-naming-prefix("field");
|
|
10
|
+
$field-input: sass.fn-naming-prefix("field-input");
|
|
11
|
+
|
|
12
|
+
// Property name
|
|
13
|
+
$app-color: sass.fn-naming-var("app", "color");
|
|
14
|
+
$spacing-x: sass.fn-naming-var("spacing", "x");
|
|
15
|
+
$spacing-y: sass.fn-naming-var("spacing", "y");
|
|
16
|
+
$size-coefficient-x: sass.fn-naming-var("coefficient-x");
|
|
17
|
+
$size-coefficient-y: sass.fn-naming-var("coefficient-y");
|
|
18
|
+
$transition-duration: sass.fn-naming-var("motion", "duration");
|
|
19
|
+
|
|
20
|
+
$select-background-color: sass.fn-naming-var("select", "background-color");
|
|
21
|
+
$select-background-color-hover: sass.fn-naming-var("select", "background-color", "hover");
|
|
22
|
+
$select-background-color-focus: sass.fn-naming-var("select", "background-color", "focus");
|
|
23
|
+
$select-background-color-active: sass.fn-naming-var("select", "background-color", "active");
|
|
24
|
+
$select-color: sass.fn-naming-var("select", "color");
|
|
25
|
+
$select-color-disabled: sass.fn-naming-var("select", "color", "disabled");
|
|
26
|
+
$select-border-color: sass.fn-naming-var("select", "border-color");
|
|
27
|
+
$select-message-color: sass.fn-naming-var("select", "message-color");
|
|
28
|
+
|
|
29
|
+
.#{$select} {
|
|
30
|
+
&.disabled {
|
|
31
|
+
cursor: not-allowed;
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
.#{$select-icon} {
|
|
35
|
+
display: inline-flex;
|
|
36
|
+
align-items: center;
|
|
37
|
+
justify-content: center;
|
|
38
|
+
flex-shrink: 0;
|
|
39
|
+
margin-inline-end: calc(#{$spacing-x} * #{$size-coefficient-x} * 0.5);
|
|
40
|
+
color: inherit;
|
|
41
|
+
pointer-events: none;
|
|
42
|
+
width: 0.6rem;
|
|
43
|
+
height: 0.6rem;
|
|
44
|
+
border-radius: 0.1rem;
|
|
45
|
+
border-right: 2px solid rgb(var(--t-app-color));
|
|
46
|
+
border-bottom: 2px solid rgb(var(--t-app-color));
|
|
47
|
+
margin: calc(var(--t-spacing-y) * var(--t-coefficient-y))
|
|
48
|
+
calc(var(--t-spacing-x) * var(--t-coefficient-x));
|
|
49
|
+
transition: transform #{$transition-duration} ease;
|
|
50
|
+
transform-origin: center;
|
|
51
|
+
|
|
52
|
+
&.open {
|
|
53
|
+
transform: rotate(225deg);
|
|
54
|
+
}
|
|
55
|
+
|
|
56
|
+
&:not(.open) {
|
|
57
|
+
transform: rotate(45deg);
|
|
58
|
+
}
|
|
59
|
+
}
|
|
60
|
+
|
|
61
|
+
.#{$select-option} {
|
|
62
|
+
display: block;
|
|
63
|
+
width: 100%;
|
|
64
|
+
padding: calc(var(--t-spacing-y)) calc(var(--t-spacing-x) * var(--t-coefficient-x));
|
|
65
|
+
text-align: var(--t-text-align);
|
|
66
|
+
text-overflow: ellipsis;
|
|
67
|
+
white-space: nowrap;
|
|
68
|
+
overflow: hidden;
|
|
69
|
+
background: transparent;
|
|
70
|
+
cursor: pointer;
|
|
71
|
+
color: rgb(#{$select-color});
|
|
72
|
+
background-color: rgb(#{$select-background-color});
|
|
73
|
+
transition:
|
|
74
|
+
box-shadow #{$transition-duration} ease,
|
|
75
|
+
border-color #{$transition-duration} ease,
|
|
76
|
+
background-color #{$transition-duration} ease,
|
|
77
|
+
color #{$transition-duration} ease,
|
|
78
|
+
border-radius #{$transition-duration} ease;
|
|
79
|
+
|
|
80
|
+
&:not(:disabled):not(.disabled):not(.readonly) {
|
|
81
|
+
&:hover,
|
|
82
|
+
&.hover {
|
|
83
|
+
background: rgb(#{$select-background-color-hover});
|
|
84
|
+
}
|
|
85
|
+
|
|
86
|
+
&:focus,
|
|
87
|
+
&.focus {
|
|
88
|
+
background: rgb(#{$select-background-color-focus});
|
|
89
|
+
}
|
|
90
|
+
|
|
91
|
+
&:active,
|
|
92
|
+
&.active {
|
|
93
|
+
background: rgb(#{$select-background-color-active});
|
|
94
|
+
}
|
|
95
|
+
}
|
|
96
|
+
|
|
97
|
+
&:disabled,
|
|
98
|
+
&.disabled {
|
|
99
|
+
cursor: not-allowed;
|
|
100
|
+
color: rgb(#{$select-color-disabled});
|
|
101
|
+
}
|
|
102
|
+
}
|
|
103
|
+
|
|
104
|
+
// Message
|
|
105
|
+
.#{$select-message} {
|
|
106
|
+
color: rgb(#{$select-message-color});
|
|
107
|
+
font-size: 0.9em;
|
|
108
|
+
line-height: 1.5;
|
|
109
|
+
transition:
|
|
110
|
+
box-shadow #{$transition-duration} ease,
|
|
111
|
+
border-color #{$transition-duration} ease,
|
|
112
|
+
background-color #{$transition-duration} ease,
|
|
113
|
+
color #{$transition-duration} ease,
|
|
114
|
+
border-radius #{$transition-duration} ease;
|
|
115
|
+
}
|
|
116
|
+
|
|
117
|
+
// Help
|
|
118
|
+
.#{$select-help} {
|
|
119
|
+
color: rgb(#{$app-color}, 0.75);
|
|
120
|
+
font-size: 0.8em;
|
|
121
|
+
line-height: 1.5;
|
|
122
|
+
transition:
|
|
123
|
+
box-shadow #{$transition-duration} ease,
|
|
124
|
+
border-color #{$transition-duration} ease,
|
|
125
|
+
background-color #{$transition-duration} ease,
|
|
126
|
+
color #{$transition-duration} ease,
|
|
127
|
+
border-radius #{$transition-duration} ease;
|
|
128
|
+
}
|
|
129
|
+
}
|
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
import type { FieldSize, FieldVariant } from "../field";
|
|
2
|
+
import type { AppDirection } from "../app";
|
|
3
|
+
|
|
4
|
+
export type SelectVariant = FieldVariant;
|
|
5
|
+
export type SelectSize = FieldSize;
|
|
6
|
+
|
|
7
|
+
export type SelectOption = {
|
|
8
|
+
label?: string;
|
|
9
|
+
value: string;
|
|
10
|
+
disabled?: boolean;
|
|
11
|
+
};
|
|
12
|
+
|
|
13
|
+
export type SelectProps = {
|
|
14
|
+
// Wrapper
|
|
15
|
+
modelValue?: string;
|
|
16
|
+
name?: string;
|
|
17
|
+
variant?: FieldVariant;
|
|
18
|
+
role?: string;
|
|
19
|
+
shape?: string;
|
|
20
|
+
size?: FieldSize;
|
|
21
|
+
shadow?: boolean;
|
|
22
|
+
direction?: AppDirection;
|
|
23
|
+
|
|
24
|
+
// Input
|
|
25
|
+
id?: string;
|
|
26
|
+
value?: string;
|
|
27
|
+
placeholder?: string;
|
|
28
|
+
disabled?: boolean;
|
|
29
|
+
autocomplete?: string;
|
|
30
|
+
tabindex?: number | string;
|
|
31
|
+
line?: number | string;
|
|
32
|
+
maxLine?: number | string;
|
|
33
|
+
|
|
34
|
+
// Support
|
|
35
|
+
message?: string;
|
|
36
|
+
help?: string;
|
|
37
|
+
|
|
38
|
+
// Data
|
|
39
|
+
options: Array<SelectOption>;
|
|
40
|
+
};
|
|
41
|
+
|
|
42
|
+
export type SelectEmit = {
|
|
43
|
+
(e: "update:modelValue", value: string): void;
|
|
44
|
+
(e: "select", option: SelectOption): void;
|
|
45
|
+
};
|