@v-c/tabs 0.0.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.
Files changed (66) hide show
  1. package/LICENSE +21 -0
  2. package/dist/TabContext.cjs +11 -0
  3. package/dist/TabContext.d.ts +8 -0
  4. package/dist/TabContext.js +9 -0
  5. package/dist/TabNavList/AddButton.cjs +4 -0
  6. package/dist/TabNavList/AddButton.js +3 -0
  7. package/dist/TabNavList/AddButton.vue_vue_type_script_setup_true_lang.cjs +36 -0
  8. package/dist/TabNavList/AddButton.vue_vue_type_script_setup_true_lang.js +35 -0
  9. package/dist/TabNavList/ExtraContent.cjs +4 -0
  10. package/dist/TabNavList/ExtraContent.js +3 -0
  11. package/dist/TabNavList/ExtraContent.vue_vue_type_script_setup_true_lang.cjs +51 -0
  12. package/dist/TabNavList/ExtraContent.vue_vue_type_script_setup_true_lang.js +49 -0
  13. package/dist/TabNavList/OperationNode.cjs +4 -0
  14. package/dist/TabNavList/OperationNode.js +3 -0
  15. package/dist/TabNavList/OperationNode.vue_vue_type_script_setup_true_lang.cjs +210 -0
  16. package/dist/TabNavList/OperationNode.vue_vue_type_script_setup_true_lang.js +205 -0
  17. package/dist/TabNavList/TabNode.cjs +4 -0
  18. package/dist/TabNavList/TabNode.js +3 -0
  19. package/dist/TabNavList/TabNode.vue_vue_type_script_setup_true_lang.cjs +129 -0
  20. package/dist/TabNavList/TabNode.vue_vue_type_script_setup_true_lang.js +127 -0
  21. package/dist/TabNavList/Wrapper.cjs +4 -0
  22. package/dist/TabNavList/Wrapper.js +3 -0
  23. package/dist/TabNavList/Wrapper.vue_vue_type_script_setup_true_lang.cjs +54 -0
  24. package/dist/TabNavList/Wrapper.vue_vue_type_script_setup_true_lang.js +52 -0
  25. package/dist/TabNavList/index.cjs +4 -0
  26. package/dist/TabNavList/index.js +3 -0
  27. package/dist/TabNavList/index.vue_vue_type_script_setup_true_lang.cjs +516 -0
  28. package/dist/TabNavList/index.vue_vue_type_script_setup_true_lang.js +513 -0
  29. package/dist/TabPanelList/TabPane.cjs +4 -0
  30. package/dist/TabPanelList/TabPane.js +3 -0
  31. package/dist/TabPanelList/TabPane.vue_vue_type_script_setup_true_lang.cjs +85 -0
  32. package/dist/TabPanelList/TabPane.vue_vue_type_script_setup_true_lang.js +83 -0
  33. package/dist/TabPanelList/index.cjs +4 -0
  34. package/dist/TabPanelList/index.js +3 -0
  35. package/dist/TabPanelList/index.vue_vue_type_script_setup_true_lang.cjs +105 -0
  36. package/dist/TabPanelList/index.vue_vue_type_script_setup_true_lang.js +103 -0
  37. package/dist/Tabs.cjs +4 -0
  38. package/dist/Tabs.js +3 -0
  39. package/dist/Tabs.vue_vue_type_script_setup_true_lang.cjs +194 -0
  40. package/dist/Tabs.vue_vue_type_script_setup_true_lang.js +190 -0
  41. package/dist/_virtual/rolldown_runtime.cjs +21 -0
  42. package/dist/hooks/useAnimateConfig.cjs +28 -0
  43. package/dist/hooks/useAnimateConfig.d.ts +2 -0
  44. package/dist/hooks/useAnimateConfig.js +26 -0
  45. package/dist/hooks/useIndicator.cjs +68 -0
  46. package/dist/hooks/useIndicator.d.ts +11 -0
  47. package/dist/hooks/useIndicator.js +65 -0
  48. package/dist/hooks/useOffsets.cjs +39 -0
  49. package/dist/hooks/useOffsets.d.ts +18 -0
  50. package/dist/hooks/useOffsets.js +37 -0
  51. package/dist/hooks/useTouchMove.cjs +119 -0
  52. package/dist/hooks/useTouchMove.d.ts +2 -0
  53. package/dist/hooks/useTouchMove.js +117 -0
  54. package/dist/hooks/useVisibleRange.cjs +51 -0
  55. package/dist/hooks/useVisibleRange.d.ts +17 -0
  56. package/dist/hooks/useVisibleRange.js +49 -0
  57. package/dist/index.cjs +4 -0
  58. package/dist/index.d.ts +5 -0
  59. package/dist/index.js +3 -0
  60. package/dist/interface.cjs +0 -0
  61. package/dist/interface.d.ts +195 -0
  62. package/dist/interface.js +0 -0
  63. package/dist/utils.cjs +33 -0
  64. package/dist/utils.d.ts +14 -0
  65. package/dist/utils.js +27 -0
  66. package/package.json +44 -0
@@ -0,0 +1,4 @@
1
+ Object.defineProperty(exports, "__esModule", { value: true });
2
+ const require_TabNode_vue_vue_type_script_setup_true_lang = require("./TabNode.vue_vue_type_script_setup_true_lang.cjs");
3
+ var TabNode_default = require_TabNode_vue_vue_type_script_setup_true_lang.default;
4
+ exports.default = TabNode_default;
@@ -0,0 +1,3 @@
1
+ import TabNode_vue_vue_type_script_setup_true_lang_default from "./TabNode.vue_vue_type_script_setup_true_lang.js";
2
+ var TabNode_default = TabNode_vue_vue_type_script_setup_true_lang_default;
3
+ export { TabNode_default as default };
@@ -0,0 +1,129 @@
1
+ const require_rolldown_runtime = require("../_virtual/rolldown_runtime.cjs");
2
+ const require_utils = require("../utils.cjs");
3
+ let vue = require("vue");
4
+ let __v_c_util_dist_RenderComponent = require("@v-c/util/dist/RenderComponent");
5
+ __v_c_util_dist_RenderComponent = require_rolldown_runtime.__toESM(__v_c_util_dist_RenderComponent);
6
+ let __v_c_util_dist_props_util = require("@v-c/util/dist/props-util");
7
+ var TabNode_vue_vue_type_script_setup_true_lang_default = /* @__PURE__ */ (0, vue.defineComponent)({
8
+ name: "TabNode",
9
+ inheritAttrs: false,
10
+ __name: "TabNode",
11
+ props: {
12
+ id: {},
13
+ prefixCls: {},
14
+ tab: {},
15
+ active: { type: Boolean },
16
+ focus: { type: Boolean },
17
+ closable: { type: Boolean },
18
+ editable: {},
19
+ onClick: { type: Function },
20
+ onResize: { type: Function },
21
+ renderWrapper: { type: Function },
22
+ removeAriaLabel: {},
23
+ tabCount: {},
24
+ currentPosition: {},
25
+ removeIcon: { type: [
26
+ Object,
27
+ String,
28
+ Number,
29
+ null,
30
+ Boolean,
31
+ Array
32
+ ] },
33
+ onKeyDown: { type: Function },
34
+ onMouseDown: { type: Function },
35
+ onMouseUp: { type: Function },
36
+ onFocus: { type: Function },
37
+ onBlur: { type: Function },
38
+ style: {},
39
+ className: {}
40
+ },
41
+ setup(__props) {
42
+ const props = __props;
43
+ const btnRef = (0, vue.ref)();
44
+ function setBtnRef(el) {
45
+ btnRef.value = el;
46
+ }
47
+ const { prefixCls, tab, closable, active, editable, focus } = (0, vue.toRefs)(props);
48
+ const removable = (0, vue.computed)(() => require_utils.getRemovable(closable.value, tab.value.closeIcon, editable.value, tab.value.disabled));
49
+ const tabPrefix = (0, vue.computed)(() => `${prefixCls.value}-tab`);
50
+ function onInternalClick(e) {
51
+ if (tab.value.disabled) return;
52
+ props.onClick?.(e);
53
+ }
54
+ const cls = (0, vue.computed)(() => [
55
+ tabPrefix.value,
56
+ props.className,
57
+ {
58
+ [`${tabPrefix.value}-with-remove`]: removable.value,
59
+ [`${tabPrefix.value}-active`]: active.value,
60
+ [`${tabPrefix.value}-disabled`]: tab.value.disabled,
61
+ [`${tabPrefix.value}-focus`]: focus.value
62
+ }
63
+ ]);
64
+ function onRemove(event) {
65
+ event.preventDefault();
66
+ event.stopPropagation();
67
+ editable.value?.onEdit("remove", {
68
+ key: tab.value.key,
69
+ event
70
+ });
71
+ }
72
+ (0, vue.onMounted)(() => {
73
+ (0, vue.watch)(() => focus.value, () => {
74
+ if (focus.value && btnRef.value) btnRef.value.focus();
75
+ }, { immediate: true });
76
+ });
77
+ const node = (0, vue.computed)(() => {
78
+ const btnChildren = [];
79
+ if (focus.value) btnChildren.push((0, vue.h)("div", {
80
+ "aria-live": "polite",
81
+ "style": "width: 0; height: 0; position: absolute; overflow: hidden; opacity: 0;"
82
+ }, `Tab ${props.currentPosition} of ${props.tabCount}`));
83
+ if (tab.value.icon) btnChildren.push((0, vue.h)("span", { class: [`${tabPrefix.value}-icon`] }, [(0, vue.h)(__v_c_util_dist_RenderComponent.default, { render: tab.value.icon })]));
84
+ if (tab.value.label) if (typeof tab.value.label === "string" && !(0, __v_c_util_dist_props_util.isEmptyElement)(tab.value.icon)) btnChildren.push((0, vue.h)("span", {}, tab.value.label));
85
+ else btnChildren.push(tab.value.label);
86
+ const children = [(0, vue.h)("div", {
87
+ "id": tab.value.id && `${tab.value.id}-tab-${tab.value.key}`,
88
+ "ref": setBtnRef,
89
+ "role": "tab",
90
+ "aria-selected": active.value,
91
+ "class": [`${tabPrefix.value}-btn`],
92
+ "aria-controls": tab.value.id && `${tab.value.id}-panel-${tab.value.key}`,
93
+ "aria-disabled": tab.value.disabled,
94
+ "tabindex": tab.value.disabled ? void 0 : active.value ? 0 : -1,
95
+ "onClick": (e) => {
96
+ e.stopPropagation();
97
+ onInternalClick(e);
98
+ },
99
+ "onKeydown": props.onKeyDown,
100
+ "onMousedown": props.onMouseDown,
101
+ "onMouseup": props.onMouseUp,
102
+ "onFocus": props.onFocus,
103
+ "onBlur": props.onBlur
104
+ }, btnChildren)];
105
+ if (removable.value) children.push((0, vue.h)("button", {
106
+ "type": "button",
107
+ "aria-label": props.removeAriaLabel || "remove",
108
+ "tabindex": active.value ? 0 : -1,
109
+ "class": [`${tabPrefix.value}-remove`],
110
+ "onClick": (e) => {
111
+ e.stopPropagation();
112
+ onRemove(e);
113
+ }
114
+ }, [(0, vue.h)(__v_c_util_dist_RenderComponent.default, { render: tab.value.closeIcon || editable.value && editable.value.removeIcon || "×" })]));
115
+ return (0, vue.h)("div", {
116
+ "key": tab.value.key,
117
+ "data-node-key": require_utils.genDataNodeKey(tab.value.key),
118
+ "class": cls.value,
119
+ "style": props.style,
120
+ "onClick": onInternalClick
121
+ }, children);
122
+ });
123
+ const finalNode = (0, vue.computed)(() => props.renderWrapper ? props.renderWrapper(node.value) : node.value);
124
+ return (_ctx, _cache) => {
125
+ return (0, vue.openBlock)(), (0, vue.createBlock)((0, vue.unref)(__v_c_util_dist_RenderComponent.default), { render: finalNode.value }, null, 8, ["render"]);
126
+ };
127
+ }
128
+ });
129
+ exports.default = TabNode_vue_vue_type_script_setup_true_lang_default;
@@ -0,0 +1,127 @@
1
+ import { genDataNodeKey, getRemovable } from "../utils.js";
2
+ import { computed, createBlock, defineComponent, h, onMounted, openBlock, ref, toRefs, unref, watch } from "vue";
3
+ import RenderComponent from "@v-c/util/dist/RenderComponent";
4
+ import { isEmptyElement } from "@v-c/util/dist/props-util";
5
+ var TabNode_vue_vue_type_script_setup_true_lang_default = /* @__PURE__ */ defineComponent({
6
+ name: "TabNode",
7
+ inheritAttrs: false,
8
+ __name: "TabNode",
9
+ props: {
10
+ id: {},
11
+ prefixCls: {},
12
+ tab: {},
13
+ active: { type: Boolean },
14
+ focus: { type: Boolean },
15
+ closable: { type: Boolean },
16
+ editable: {},
17
+ onClick: { type: Function },
18
+ onResize: { type: Function },
19
+ renderWrapper: { type: Function },
20
+ removeAriaLabel: {},
21
+ tabCount: {},
22
+ currentPosition: {},
23
+ removeIcon: { type: [
24
+ Object,
25
+ String,
26
+ Number,
27
+ null,
28
+ Boolean,
29
+ Array
30
+ ] },
31
+ onKeyDown: { type: Function },
32
+ onMouseDown: { type: Function },
33
+ onMouseUp: { type: Function },
34
+ onFocus: { type: Function },
35
+ onBlur: { type: Function },
36
+ style: {},
37
+ className: {}
38
+ },
39
+ setup(__props) {
40
+ const props = __props;
41
+ const btnRef = ref();
42
+ function setBtnRef(el) {
43
+ btnRef.value = el;
44
+ }
45
+ const { prefixCls, tab, closable, active, editable, focus } = toRefs(props);
46
+ const removable = computed(() => getRemovable(closable.value, tab.value.closeIcon, editable.value, tab.value.disabled));
47
+ const tabPrefix = computed(() => `${prefixCls.value}-tab`);
48
+ function onInternalClick(e) {
49
+ if (tab.value.disabled) return;
50
+ props.onClick?.(e);
51
+ }
52
+ const cls = computed(() => [
53
+ tabPrefix.value,
54
+ props.className,
55
+ {
56
+ [`${tabPrefix.value}-with-remove`]: removable.value,
57
+ [`${tabPrefix.value}-active`]: active.value,
58
+ [`${tabPrefix.value}-disabled`]: tab.value.disabled,
59
+ [`${tabPrefix.value}-focus`]: focus.value
60
+ }
61
+ ]);
62
+ function onRemove(event) {
63
+ event.preventDefault();
64
+ event.stopPropagation();
65
+ editable.value?.onEdit("remove", {
66
+ key: tab.value.key,
67
+ event
68
+ });
69
+ }
70
+ onMounted(() => {
71
+ watch(() => focus.value, () => {
72
+ if (focus.value && btnRef.value) btnRef.value.focus();
73
+ }, { immediate: true });
74
+ });
75
+ const node = computed(() => {
76
+ const btnChildren = [];
77
+ if (focus.value) btnChildren.push(h("div", {
78
+ "aria-live": "polite",
79
+ "style": "width: 0; height: 0; position: absolute; overflow: hidden; opacity: 0;"
80
+ }, `Tab ${props.currentPosition} of ${props.tabCount}`));
81
+ if (tab.value.icon) btnChildren.push(h("span", { class: [`${tabPrefix.value}-icon`] }, [h(RenderComponent, { render: tab.value.icon })]));
82
+ if (tab.value.label) if (typeof tab.value.label === "string" && !isEmptyElement(tab.value.icon)) btnChildren.push(h("span", {}, tab.value.label));
83
+ else btnChildren.push(tab.value.label);
84
+ const children = [h("div", {
85
+ "id": tab.value.id && `${tab.value.id}-tab-${tab.value.key}`,
86
+ "ref": setBtnRef,
87
+ "role": "tab",
88
+ "aria-selected": active.value,
89
+ "class": [`${tabPrefix.value}-btn`],
90
+ "aria-controls": tab.value.id && `${tab.value.id}-panel-${tab.value.key}`,
91
+ "aria-disabled": tab.value.disabled,
92
+ "tabindex": tab.value.disabled ? void 0 : active.value ? 0 : -1,
93
+ "onClick": (e) => {
94
+ e.stopPropagation();
95
+ onInternalClick(e);
96
+ },
97
+ "onKeydown": props.onKeyDown,
98
+ "onMousedown": props.onMouseDown,
99
+ "onMouseup": props.onMouseUp,
100
+ "onFocus": props.onFocus,
101
+ "onBlur": props.onBlur
102
+ }, btnChildren)];
103
+ if (removable.value) children.push(h("button", {
104
+ "type": "button",
105
+ "aria-label": props.removeAriaLabel || "remove",
106
+ "tabindex": active.value ? 0 : -1,
107
+ "class": [`${tabPrefix.value}-remove`],
108
+ "onClick": (e) => {
109
+ e.stopPropagation();
110
+ onRemove(e);
111
+ }
112
+ }, [h(RenderComponent, { render: tab.value.closeIcon || editable.value && editable.value.removeIcon || "×" })]));
113
+ return h("div", {
114
+ "key": tab.value.key,
115
+ "data-node-key": genDataNodeKey(tab.value.key),
116
+ "class": cls.value,
117
+ "style": props.style,
118
+ "onClick": onInternalClick
119
+ }, children);
120
+ });
121
+ const finalNode = computed(() => props.renderWrapper ? props.renderWrapper(node.value) : node.value);
122
+ return (_ctx, _cache) => {
123
+ return openBlock(), createBlock(unref(RenderComponent), { render: finalNode.value }, null, 8, ["render"]);
124
+ };
125
+ }
126
+ });
127
+ export { TabNode_vue_vue_type_script_setup_true_lang_default as default };
@@ -0,0 +1,4 @@
1
+ Object.defineProperty(exports, "__esModule", { value: true });
2
+ const require_Wrapper_vue_vue_type_script_setup_true_lang = require("./Wrapper.vue_vue_type_script_setup_true_lang.cjs");
3
+ var Wrapper_default = require_Wrapper_vue_vue_type_script_setup_true_lang.default;
4
+ exports.default = Wrapper_default;
@@ -0,0 +1,3 @@
1
+ import Wrapper_vue_vue_type_script_setup_true_lang_default from "./Wrapper.vue_vue_type_script_setup_true_lang.js";
2
+ var Wrapper_default = Wrapper_vue_vue_type_script_setup_true_lang_default;
3
+ export { Wrapper_default as default };
@@ -0,0 +1,54 @@
1
+ const require_rolldown_runtime = require("../_virtual/rolldown_runtime.cjs");
2
+ const require_index = require("./index.cjs");
3
+ let vue = require("vue");
4
+ let __v_c_util_dist_RenderComponent = require("@v-c/util/dist/RenderComponent");
5
+ __v_c_util_dist_RenderComponent = require_rolldown_runtime.__toESM(__v_c_util_dist_RenderComponent);
6
+ var Wrapper_vue_vue_type_script_setup_true_lang_default = /* @__PURE__ */ (0, vue.defineComponent)({
7
+ name: "TabNavListWrapper",
8
+ inheritAttrs: false,
9
+ __name: "Wrapper",
10
+ props: {
11
+ id: {},
12
+ tabPosition: {},
13
+ activeKey: {},
14
+ rtl: { type: Boolean },
15
+ animated: {},
16
+ extra: { type: [
17
+ Object,
18
+ String,
19
+ Number,
20
+ null,
21
+ Boolean,
22
+ Array
23
+ ] },
24
+ editable: {},
25
+ more: {},
26
+ mobile: { type: Boolean },
27
+ tabBarGutter: {},
28
+ renderTabBar: { type: Function },
29
+ style: {},
30
+ locale: {},
31
+ onTabClick: { type: Function },
32
+ onTabScroll: { type: Function },
33
+ getPopupContainer: { type: Function },
34
+ popupClassName: {},
35
+ indicator: {},
36
+ classNames: {},
37
+ styles: {},
38
+ className: {},
39
+ children: { type: Function }
40
+ },
41
+ setup(__props) {
42
+ const props = __props;
43
+ const renderNode = (0, vue.computed)(() => {
44
+ const restProps = { ...props };
45
+ delete restProps.renderTabBar;
46
+ if (props.renderTabBar) return props.renderTabBar(restProps, require_index.default);
47
+ return (0, vue.h)(require_index.default, restProps);
48
+ });
49
+ return (_ctx, _cache) => {
50
+ return (0, vue.openBlock)(), (0, vue.createBlock)((0, vue.unref)(__v_c_util_dist_RenderComponent.default), { render: renderNode.value }, null, 8, ["render"]);
51
+ };
52
+ }
53
+ });
54
+ exports.default = Wrapper_vue_vue_type_script_setup_true_lang_default;
@@ -0,0 +1,52 @@
1
+ import TabNavList_default from "./index.js";
2
+ import { computed, createBlock, defineComponent, h, openBlock, unref } from "vue";
3
+ import RenderComponent from "@v-c/util/dist/RenderComponent";
4
+ var Wrapper_vue_vue_type_script_setup_true_lang_default = /* @__PURE__ */ defineComponent({
5
+ name: "TabNavListWrapper",
6
+ inheritAttrs: false,
7
+ __name: "Wrapper",
8
+ props: {
9
+ id: {},
10
+ tabPosition: {},
11
+ activeKey: {},
12
+ rtl: { type: Boolean },
13
+ animated: {},
14
+ extra: { type: [
15
+ Object,
16
+ String,
17
+ Number,
18
+ null,
19
+ Boolean,
20
+ Array
21
+ ] },
22
+ editable: {},
23
+ more: {},
24
+ mobile: { type: Boolean },
25
+ tabBarGutter: {},
26
+ renderTabBar: { type: Function },
27
+ style: {},
28
+ locale: {},
29
+ onTabClick: { type: Function },
30
+ onTabScroll: { type: Function },
31
+ getPopupContainer: { type: Function },
32
+ popupClassName: {},
33
+ indicator: {},
34
+ classNames: {},
35
+ styles: {},
36
+ className: {},
37
+ children: { type: Function }
38
+ },
39
+ setup(__props) {
40
+ const props = __props;
41
+ const renderNode = computed(() => {
42
+ const restProps = { ...props };
43
+ delete restProps.renderTabBar;
44
+ if (props.renderTabBar) return props.renderTabBar(restProps, TabNavList_default);
45
+ return h(TabNavList_default, restProps);
46
+ });
47
+ return (_ctx, _cache) => {
48
+ return openBlock(), createBlock(unref(RenderComponent), { render: renderNode.value }, null, 8, ["render"]);
49
+ };
50
+ }
51
+ });
52
+ export { Wrapper_vue_vue_type_script_setup_true_lang_default as default };
@@ -0,0 +1,4 @@
1
+ Object.defineProperty(exports, "__esModule", { value: true });
2
+ const require_index_vue_vue_type_script_setup_true_lang = require("./index.vue_vue_type_script_setup_true_lang.cjs");
3
+ var TabNavList_default = require_index_vue_vue_type_script_setup_true_lang.default;
4
+ exports.default = TabNavList_default;
@@ -0,0 +1,3 @@
1
+ import index_vue_vue_type_script_setup_true_lang_default from "./index.vue_vue_type_script_setup_true_lang.js";
2
+ var TabNavList_default = index_vue_vue_type_script_setup_true_lang_default;
3
+ export { TabNavList_default as default };