2020-07-27 06:34:20 +02:00
|
|
|
<script lang="ts">
|
2023-04-08 02:01:42 +02:00
|
|
|
import { defineComponent, h, resolveDirective, withDirectives } from "vue";
|
2020-07-27 06:34:20 +02:00
|
|
|
|
2020-10-17 13:12:00 +02:00
|
|
|
export default defineComponent({
|
2020-07-27 06:34:20 +02:00
|
|
|
props: {
|
2021-09-29 17:50:45 +02:00
|
|
|
modelValue: {
|
2020-07-27 06:34:20 +02:00
|
|
|
required: true,
|
|
|
|
},
|
2023-05-19 19:02:41 +02:00
|
|
|
style: {
|
|
|
|
required: false,
|
|
|
|
},
|
2020-07-27 06:34:20 +02:00
|
|
|
},
|
2020-11-17 06:59:15 +01:00
|
|
|
render() {
|
|
|
|
const options = this.$slots.default();
|
|
|
|
|
2023-04-08 02:01:42 +02:00
|
|
|
return h(
|
|
|
|
"div",
|
|
|
|
{
|
2023-05-20 18:08:20 +02:00
|
|
|
class: ["pxhvhrfw",
|
|
|
|
{ chips: this.style === "chips" },
|
|
|
|
{ underline: this.style === "underline" }
|
|
|
|
],
|
2023-05-19 19:20:48 +02:00
|
|
|
role: "tablist",
|
2022-07-24 08:45:16 +02:00
|
|
|
},
|
2023-04-08 02:01:42 +02:00
|
|
|
options.map((option) =>
|
|
|
|
withDirectives(
|
|
|
|
h(
|
|
|
|
"button",
|
|
|
|
{
|
2023-05-19 19:20:48 +02:00
|
|
|
class: "_button",
|
|
|
|
role: "tab",
|
2023-04-08 02:01:42 +02:00
|
|
|
key: option.key,
|
2023-05-20 00:41:59 +02:00
|
|
|
"aria-selected":
|
|
|
|
this.modelValue === option.props?.value
|
|
|
|
? "true"
|
|
|
|
: "false",
|
2023-04-08 02:01:42 +02:00
|
|
|
onClick: () => {
|
|
|
|
this.$emit(
|
|
|
|
"update:modelValue",
|
|
|
|
option.props?.value
|
|
|
|
);
|
|
|
|
},
|
|
|
|
},
|
|
|
|
option.children
|
|
|
|
),
|
|
|
|
[[resolveDirective("click-anime")]]
|
|
|
|
)
|
|
|
|
)
|
|
|
|
);
|
2022-07-24 08:45:16 +02:00
|
|
|
},
|
2020-07-27 06:34:20 +02:00
|
|
|
});
|
|
|
|
</script>
|
|
|
|
|
2020-11-17 06:59:15 +01:00
|
|
|
<style lang="scss">
|
2020-07-27 06:34:20 +02:00
|
|
|
.pxhvhrfw {
|
|
|
|
display: flex;
|
2021-04-22 15:29:33 +02:00
|
|
|
font-size: 90%;
|
2022-07-27 06:35:03 +02:00
|
|
|
border-radius: var(--radius);
|
|
|
|
padding: 10px 8px;
|
2020-07-27 06:34:20 +02:00
|
|
|
|
|
|
|
> button {
|
|
|
|
flex: 1;
|
2021-10-16 11:18:41 +02:00
|
|
|
padding: 10px 8px;
|
2023-02-01 21:19:01 +01:00
|
|
|
margin: 0 8px;
|
2021-10-17 11:47:33 +02:00
|
|
|
border-radius: var(--radius);
|
2020-07-27 06:34:20 +02:00
|
|
|
|
2020-11-01 06:05:06 +01:00
|
|
|
&:disabled {
|
|
|
|
opacity: 1 !important;
|
|
|
|
cursor: default;
|
|
|
|
}
|
|
|
|
|
2023-05-19 19:20:48 +02:00
|
|
|
&[aria-selected="true"] {
|
2020-07-27 06:34:20 +02:00
|
|
|
color: var(--accent);
|
2023-05-19 19:02:41 +02:00
|
|
|
background: var(--accentedBg) !important;
|
2020-07-27 06:34:20 +02:00
|
|
|
}
|
2020-07-28 03:08:08 +02:00
|
|
|
|
2023-05-19 19:20:48 +02:00
|
|
|
&:not([aria-selected="true"]):hover {
|
2020-11-01 06:05:06 +01:00
|
|
|
color: var(--fgHighlighted);
|
2021-10-16 11:18:41 +02:00
|
|
|
background: var(--panelHighlight);
|
|
|
|
}
|
|
|
|
|
|
|
|
&:not(:first-child) {
|
|
|
|
margin-left: 8px;
|
2020-11-01 06:05:06 +01:00
|
|
|
}
|
|
|
|
|
2020-07-28 03:08:08 +02:00
|
|
|
> .icon {
|
|
|
|
margin-right: 6px;
|
|
|
|
}
|
2020-07-27 06:34:20 +02:00
|
|
|
}
|
|
|
|
|
2023-05-20 18:08:20 +02:00
|
|
|
&.chips, &.underline {
|
2023-05-19 19:02:41 +02:00
|
|
|
padding: 12px 32px;
|
2023-05-20 00:41:59 +02:00
|
|
|
font-size: 0.85em;
|
2023-05-19 19:02:41 +02:00
|
|
|
overflow-x: auto;
|
2023-05-20 06:14:14 +02:00
|
|
|
mask: linear-gradient(to right, black calc(100% - 90px), transparent);
|
2023-05-20 08:27:56 +02:00
|
|
|
-webkit-mask: linear-gradient(
|
|
|
|
to right,
|
|
|
|
black calc(100% - 90px),
|
|
|
|
transparent
|
|
|
|
);
|
2023-05-20 06:14:14 +02:00
|
|
|
padding-right: 90px !important;
|
|
|
|
&::-webkit-scrollbar {
|
|
|
|
display: none;
|
|
|
|
}
|
2023-05-19 19:02:41 +02:00
|
|
|
> button {
|
|
|
|
display: flex;
|
|
|
|
gap: 6px;
|
|
|
|
align-items: center;
|
|
|
|
flex: unset;
|
|
|
|
margin: 0;
|
|
|
|
margin-right: 8px;
|
2023-05-20 00:41:59 +02:00
|
|
|
padding: 0.5em 1em;
|
2023-05-19 19:02:41 +02:00
|
|
|
border-radius: 100px;
|
|
|
|
background: var(--buttonBg);
|
|
|
|
> i {
|
2023-05-20 00:41:59 +02:00
|
|
|
margin-top: -0.1em;
|
2023-05-19 19:02:41 +02:00
|
|
|
}
|
2023-05-20 06:14:14 +02:00
|
|
|
> .count {
|
2023-05-20 08:27:56 +02:00
|
|
|
margin-right: -0.2em;
|
2023-05-20 06:14:14 +02:00
|
|
|
}
|
2023-05-19 19:02:41 +02:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2023-05-20 18:08:20 +02:00
|
|
|
&.underline {
|
|
|
|
padding-block: 0 !important;
|
|
|
|
margin-bottom: -1px;
|
|
|
|
button {
|
|
|
|
background: none !important;
|
|
|
|
border-radius: 0 !important;
|
|
|
|
padding-block: 10px !important;
|
|
|
|
border-bottom: 2px solid transparent;
|
|
|
|
&[aria-selected="true"] {
|
|
|
|
background: none !important;
|
|
|
|
font-weight: 700;
|
|
|
|
border-bottom-color: var(--accent);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2020-07-27 06:34:20 +02:00
|
|
|
&.max-width_500px {
|
|
|
|
font-size: 80%;
|
2020-10-17 13:12:00 +02:00
|
|
|
|
|
|
|
> button {
|
2021-10-16 11:18:41 +02:00
|
|
|
padding: 11px 8px;
|
2020-10-17 13:12:00 +02:00
|
|
|
}
|
2020-07-27 06:34:20 +02:00
|
|
|
}
|
|
|
|
}
|
|
|
|
</style>
|