@db-ux/v-core-components 4.14.0 → 5.0.0

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.
@@ -1,12 +1,28 @@
1
- import type { AlignmentProps, GlobalProps, InitializedState, InputEvent, OrientationProps, OverflowScrollButtonProps, OverflowScrollButtonState, WidthProps } from '../../shared/model.js';
1
+ import type { AlignmentType, GlobalProps, InitializedState, OrientationProps, WidthType } from '../../shared/model.js';
2
2
  import type { DBTabItemProps } from '../tab-item/model.js';
3
3
  import type { DBTabPanelProps } from '../tab-panel/model.js';
4
+ export type TabItemAlignmentType = AlignmentType;
5
+ export type TabItemAlignmentProps = {
6
+ /**
7
+ * Define the tab-item alignment in full width
8
+ */
9
+ tabItemAlignment?: TabItemAlignmentType | string;
10
+ };
4
11
  export declare const TabsBehaviorList: readonly ["scrollbar", "arrows"];
5
12
  export type TabsBehaviorType = (typeof TabsBehaviorList)[number];
6
13
  export declare const TabsInitialSelectedModeList: readonly ["auto", "manually"];
7
14
  export type TabsInitialSelectedModeType = (typeof TabsInitialSelectedModeList)[number];
8
- export type DBSimpleTabProps = DBTabItemProps & DBTabPanelProps;
15
+ export type DBSimpleTabProps = DBTabItemProps & DBTabPanelProps & {
16
+ /**
17
+ * Accessible label for icon-only tabs (rendered as aria-label on the tab button).
18
+ */
19
+ ariaLabel?: string;
20
+ };
9
21
  export type DBTabsDefaultProps = {
22
+ /**
23
+ * Change amount of distance if you click on an arrow, only available with behavior="arrows"
24
+ */
25
+ arrowScrollDistance?: number | string;
10
26
  /**
11
27
  * Show a scrollbar or buttons with arrows to navigate for horizontal tabs with overflow visible
12
28
  */
@@ -15,45 +31,104 @@ export type DBTabsDefaultProps = {
15
31
  * Default behavior is auto selecting the first tab, change selected tab by index
16
32
  */
17
33
  initialSelectedIndex?: number | string;
34
+ /**
35
+ * Controlled active tab index. When set, the component becomes controlled:
36
+ * the consumer is responsible for updating this value in the onIndexChange handler.
37
+ * Takes precedence over initialSelectedIndex after mount.
38
+ */
39
+ activeIndex?: number | string;
18
40
  /**
19
41
  * Default behavior is auto selecting the first tab, disable it with 'manually'
20
42
  */
21
43
  initialSelectedMode?: TabsInitialSelectedModeType;
22
44
  /**
23
- * The name of the tab bar, is required for grouping multiple tabs together. Will overwrite names from children.
45
+ * Accessible label for the tab bar (used as aria-label on the tablist).
24
46
  */
25
- name?: string;
47
+ label?: string;
26
48
  /**
27
49
  * Provide simple tabs with label + text as content
28
50
  */
29
51
  tabs?: DBSimpleTabProps[] | string;
52
+ /**
53
+ * Width of the tab-items. Auto width based on tab-item size, full width based on parent elements width.
54
+ */
55
+ tabItemWidth?: WidthType | string;
56
+ /**
57
+ * Accessible label for the "scroll towards start" button (i18n). Only used with behavior="arrows".
58
+ */
59
+ scrollStartLabel?: string;
60
+ /**
61
+ * Accessible label for the "scroll towards end" button (i18n). Only used with behavior="arrows".
62
+ */
63
+ scrollEndLabel?: string;
30
64
  };
31
65
  export type DBTabsEventProps = {
32
66
  /**
33
67
  * Informs the user if the current tab index has changed.
34
68
  */
35
- indexChange?: (index?: number) => void;
69
+ indexChange?: (index: number) => void;
36
70
  /**
37
71
  * Informs the user if the current tab index has changed.
38
72
  */
39
- onIndexChange?: (index?: number) => void;
73
+ onIndexChange?: (index: number) => void;
40
74
  /**
41
- * Informs the user if another tab has been selected.
75
+ * Fires when the active tab changes and a `value` prop is set on the tab items.
76
+ * Payload is the `value` string of the newly active tab item, or undefined
77
+ * if the tab item has no `value` prop set.
78
+ * Use this for form binding (e.g. Angular FormControl, React controlled state).
42
79
  */
43
- onTabSelect?: (event?: InputEvent<HTMLElement>) => void;
80
+ valueChange?: (value?: string) => void;
44
81
  /**
45
- * Informs the user if another tab has been selected.
82
+ * Fires when the active tab changes and a `value` prop is set on the tab items.
83
+ * Payload is the `value` string of the newly active tab item, or undefined
84
+ * if the tab item has no `value` prop set.
85
+ * Use this for form binding (e.g. Angular FormControl, React controlled state).
46
86
  */
47
- tabSelect?: (event?: InputEvent<HTMLElement>) => void;
87
+ onValueChange?: (value?: string) => void;
48
88
  };
49
- export type DBTabsProps = DBTabsDefaultProps & GlobalProps & OrientationProps & WidthProps & AlignmentProps & OverflowScrollButtonProps & DBTabsEventProps;
89
+ export type DBTabsProps = DBTabsDefaultProps & GlobalProps & OrientationProps & TabItemAlignmentProps & DBTabsEventProps;
50
90
  export type DBTabsDefaultState = {
51
- _name: string;
52
- scrollContainer?: Element | null;
53
- convertTabs: () => DBSimpleTabProps[];
91
+ _id?: string;
92
+ _appliedLabel?: string;
93
+ resetIds: () => void;
94
+ _getScrollContainer: () => Element | null;
95
+ scroll: (toStart?: boolean) => void;
96
+ showScrollStart?: boolean;
97
+ showScrollEnd?: boolean;
98
+ _isRtl: () => boolean;
99
+ evaluateScrollButtons: (tabList: Element) => void;
100
+ getTabs: () => DBSimpleTabProps[];
101
+ getInitialIndex: () => number;
102
+ getRenderIndex: () => number;
103
+ getRenderFocusIndex: () => number;
104
+ getActiveChildIndex: () => number;
105
+ shouldUseActiveChild: (hashApplied: boolean) => boolean;
106
+ moveRovingTabindex: (focusIndex: number) => void;
107
+ _isOwnedPanel: (panel: HTMLElement) => boolean;
54
108
  initTabList: () => void;
55
- initTabs: (init?: boolean) => void;
56
- handleChange: (event: InputEvent<HTMLElement>) => void;
57
- _resizeObserverCallbackId?: string;
109
+ _teardownScrollHandlers: () => void;
110
+ _resolveHashIndex: () => {
111
+ startIndex: number;
112
+ hashApplied: boolean;
113
+ };
114
+ _setupObserver: () => void;
115
+ initTabs: () => void;
116
+ syncSelection: (activeIndex?: number) => void;
117
+ _tabButtons: HTMLElement[];
118
+ _tabPanels: HTMLElement[];
119
+ _resizeObserver?: ResizeObserver | null;
120
+ _observer?: MutationObserver | null;
121
+ _pendingRafId: number | null;
122
+ _scrollListener: {
123
+ fn: () => void;
124
+ } | null;
125
+ _focusgroupSupported: boolean;
126
+ _activeIndex: number;
127
+ activateTab: (index: number) => void;
128
+ getTabId: (index: number | string) => string | undefined;
129
+ getPanelId: (index: number | string) => string | undefined;
130
+ getBaseId: () => string | undefined;
131
+ handleClick: (event: any) => void;
132
+ handleKeyDown: (event: any) => void;
58
133
  };
59
- export type DBTabsState = DBTabsDefaultState & InitializedState & OverflowScrollButtonState;
134
+ export type DBTabsState = DBTabsDefaultState & InitializedState;
@@ -1,27 +1,27 @@
1
- import { InputEvent } from "../../shared/model.js";
2
1
  import { DBSimpleTabProps, DBTabsProps } from "./model.js";
3
- declare var __VLS_30: {};
2
+ declare var __VLS_24: {};
4
3
  type __VLS_Slots = {} & {
5
- default?: (props: typeof __VLS_30) => any;
4
+ default?: (props: typeof __VLS_24) => any;
6
5
  };
7
6
  declare const __VLS_base: import("@vue/runtime-core").DefineComponent<DBTabsProps, {}, {}, {}, {}, import("@vue/runtime-core").ComponentOptionsMixin, import("@vue/runtime-core").ComponentOptionsMixin, {}, string, import("@vue/runtime-core").PublicProps, Readonly<DBTabsProps> & Readonly<{}>, {
8
7
  id: string;
9
8
  children: any;
10
9
  className: string;
11
- propOverrides: import("../../shared/model.js", { with: { "resolution-mode": "import" } }).PropOverridesType;
12
- name: string;
10
+ propOverrides: import("../../index.js", { with: { "resolution-mode": "import" } }).PropOverridesType;
11
+ label: string;
13
12
  behavior: import("./model.js", { with: { "resolution-mode": "import" } }).TabsBehaviorType;
14
- width: import("../../shared/model.js", { with: { "resolution-mode": "import" } }).WidthType | string;
15
- alignment: import("../../shared/model.js", { with: { "resolution-mode": "import" } }).AlignmentType | string;
13
+ orientation: import("../../index.js", { with: { "resolution-mode": "import" } }).OrientationType;
14
+ arrowScrollDistance: number | string;
16
15
  initialSelectedIndex: number | string;
16
+ activeIndex: number | string;
17
17
  initialSelectedMode: import("./model.js", { with: { "resolution-mode": "import" } }).TabsInitialSelectedModeType;
18
18
  tabs: DBSimpleTabProps[] | string;
19
- orientation: import("../../shared/model.js", { with: { "resolution-mode": "import" } }).OrientationType;
20
- arrowScrollDistance: number | string;
21
- scrollLeftText: string;
22
- scrollRightText: string;
23
- onIndexChange: (index?: number) => void;
24
- onTabSelect: (event?: InputEvent<HTMLElement>) => void;
19
+ tabItemWidth: import("../../index.js", { with: { "resolution-mode": "import" } }).WidthType | string;
20
+ scrollStartLabel: string;
21
+ scrollEndLabel: string;
22
+ tabItemAlignment: import("./model.js", { with: { "resolution-mode": "import" } }).TabItemAlignmentType | string;
23
+ onIndexChange: (index: number) => void;
24
+ onValueChange: (value?: string) => void;
25
25
  }, {}, {}, {}, string, import("@vue/runtime-core").ComponentProvideOptions, false, {}, any>;
26
26
  declare const __VLS_export: __VLS_WithSlots<typeof __VLS_base, __VLS_Slots>;
27
27
  declare const _default: typeof __VLS_export;