@sandlada/vue-mdc
Version:

67 lines (66 loc) • 2.33 kB
JavaScript
/**
* @license
* Copyright 2025 Sandlada & Kai Orion
* SPDX-License-Identifier: MIT
*/
import { defineComponent, ref, createVNode } from "vue";
import { useReflectAttribute } from "../../node_modules/@glare-labs/vue-reflect-attribute/build/vue-reflect-attribute.js";
import { componentNamePrefix } from "../../internals/component-name-prefix/component-name-prefix.js";
import { FocusRing } from "../focus-ring/focus-ring.js";
import "../../internals/navigation/render-navigation-destination.js";
import { Ripple } from "../ripple/ripple.js";
import { props } from "./navigation-tab.definition.js";
import css from "./styles/navigation-tab.module.scss.js";
const NavigationTab = /* @__PURE__ */ defineComponent({
name: `${componentNamePrefix}-navigation-tab`,
props,
slots: {},
emits: ["tab-click"],
setup(props2, {
slots,
emit
}) {
const root = ref(null);
const _hideInactiveLabel = ref(props2.hideInactiveLabel);
const _label = ref(props2.label);
useReflectAttribute(root, {
attributes: [{
attribute: "hide-inactive-label",
ref: _hideInactiveLabel,
reflect: true,
type: "boolean"
}, {
attribute: "label",
ref: _label,
reflect: true,
type: "string"
}]
});
return () => createVNode("button", {
"data-component": "navigation-tab",
"navigation-tab": true,
"class": [css["navigation-tab"]],
"role": "tab",
"ref": root
}, [createVNode(Ripple, null, null), createVNode(FocusRing, {
"inward": true,
"shapeInherit": false
}, null), createVNode("span", {
"aria-hidden": "true",
"class": css["icon-content"]
}, [createVNode("span", {
"class": css["active-indicator"]
}, null), createVNode("span", {
"class": css["icon"]
}, [slots["inactive-icon"] ? slots["inactive-icon"]() : slots.default && slots.default()]), createVNode("span", {
"class": [css["icon"], css["icon--active"]]
}, [slots["active-icon"] ? slots["active-icon"]() : slots.default && slots.default()])]), (typeof _label.value.length !== "undefined" || _label !== null) && createVNode("span", {
"class": css["label"]
}, [_label.value])]);
},
inheritAttrs: true
});
export {
NavigationTab
};
//# sourceMappingURL=navigation-tab.js.map