@db-ux/v-core-components 4.6.1 → 4.7.0-tabs-34782eb

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/CHANGELOG.md CHANGED
@@ -1,5 +1,13 @@
1
1
  # @db-ux/v-core-components
2
2
 
3
+ ## 4.7.0
4
+
5
+ ### Minor Changes
6
+
7
+ - DBSelect: correctly hiding empty `option` element for _placeholder_ or _floating label_ components with property `showEmptyOption=false` - [see commit ec01b5c](https://github.com/db-ux-design-system/core-web/commit/ec01b5cb56e1fc05911d33cbff0fc8f385644628)
8
+
9
+ - refactor(notification): not enforcing a paragraph for it's contents anymore. You could set any block level elements now as children. - [see commit 3170b3a](https://github.com/db-ux-design-system/core-web/commit/3170b3a6ef57bb73fa32b3176b7b8cf651a38641) and [commit 2ebe315](https://github.com/db-ux-design-system/core-web/commit/2ebe3156cd45e3702cf4acdc4224cd34da31d907)
10
+
3
11
  ## 4.6.1
4
12
 
5
13
  ### Patch Changes
package/agent/Tabs.md CHANGED
@@ -8,41 +8,44 @@
8
8
  <h2>1. Default Tabs</h2>
9
9
  <DBTabs
10
10
  ><DBTabList
11
- ><DBTabItem>Tab 1</DBTabItem><DBTabItem>Tab 2</DBTabItem
12
- ><DBTabItem>Tab 3</DBTabItem></DBTabList
13
- ><DBTabPanel>Tab Panel 1</DBTabPanel><DBTabPanel>Tab Panel 2</DBTabPanel
14
- ><DBTabPanel>Tab Panel 3</DBTabPanel></DBTabs
11
+ ><DBTabItem>Def Tab 1</DBTabItem><DBTabItem>Def Tab 2</DBTabItem
12
+ ><DBTabItem>Def Tab 3</DBTabItem></DBTabList
13
+ ><DBTabPanel>Def Panel 1</DBTabPanel><DBTabPanel>Def Panel 2</DBTabPanel
14
+ ><DBTabPanel>Def Panel 3</DBTabPanel></DBTabs
15
15
  >
16
16
  <h2>2. Behavior Variants</h2>
17
17
  <DBTabs behavior="scrollbar"
18
18
  ><DBTabList
19
- ><DBTabItem>Tab 1</DBTabItem><DBTabItem>Tab 2</DBTabItem
20
- ><DBTabItem>Tab 3</DBTabItem></DBTabList
21
- ><DBTabPanel>Tab Panel 1</DBTabPanel><DBTabPanel>Tab Panel 2</DBTabPanel
22
- ><DBTabPanel>Tab Panel 3</DBTabPanel></DBTabs
19
+ ><DBTabItem>Scroll Tab 1</DBTabItem><DBTabItem>Scroll Tab 2</DBTabItem
20
+ ><DBTabItem>Scroll Tab 3</DBTabItem></DBTabList
21
+ ><DBTabPanel>Scroll Panel 1</DBTabPanel
22
+ ><DBTabPanel>Scroll Panel 2</DBTabPanel
23
+ ><DBTabPanel>Scroll Panel 3</DBTabPanel></DBTabs
23
24
  >
24
25
  <DBTabs behavior="arrows"
25
26
  ><DBTabList
26
- ><DBTabItem>Tab 1</DBTabItem><DBTabItem>Tab 2</DBTabItem
27
- ><DBTabItem>Tab 3</DBTabItem></DBTabList
28
- ><DBTabPanel>Tab Panel 1</DBTabPanel><DBTabPanel>Tab Panel 2</DBTabPanel
29
- ><DBTabPanel>Tab Panel 3</DBTabPanel></DBTabs
27
+ ><DBTabItem>Arrow Tab 1</DBTabItem><DBTabItem>Arrow Tab 2</DBTabItem
28
+ ><DBTabItem>Arrow Tab 3</DBTabItem></DBTabList
29
+ ><DBTabPanel>Arrow Panel 1</DBTabPanel><DBTabPanel>Arrow Panel 2</DBTabPanel
30
+ ><DBTabPanel>Arrow Panel 3</DBTabPanel></DBTabs
30
31
  >
31
32
  <h2>3. Initial Selected Index</h2>
32
33
  <DBTabs :initialSelectedIndex="1"
33
34
  ><DBTabList
34
- ><DBTabItem>Tab 1</DBTabItem><DBTabItem>Tab 2</DBTabItem
35
- ><DBTabItem>Tab 3</DBTabItem></DBTabList
36
- ><DBTabPanel>Tab Panel 1</DBTabPanel><DBTabPanel>Tab Panel 2</DBTabPanel
37
- ><DBTabPanel>Tab Panel 3</DBTabPanel></DBTabs
35
+ ><DBTabItem>InitIdx Tab 1</DBTabItem><DBTabItem>InitIdx Tab 2</DBTabItem
36
+ ><DBTabItem>InitIdx Tab 3</DBTabItem></DBTabList
37
+ ><DBTabPanel>InitIdx Panel 1</DBTabPanel
38
+ ><DBTabPanel>InitIdx Panel 2</DBTabPanel
39
+ ><DBTabPanel>InitIdx Panel 3</DBTabPanel></DBTabs
38
40
  >
39
41
  <h2>4. Initial Selected Mode</h2>
40
42
  <DBTabs initialSelectedMode="manually"
41
43
  ><DBTabList
42
- ><DBTabItem>Tab 1</DBTabItem><DBTabItem>Tab 2</DBTabItem
43
- ><DBTabItem>Tab 3</DBTabItem></DBTabList
44
- ><DBTabPanel>Tab Panel 1</DBTabPanel><DBTabPanel>Tab Panel 2</DBTabPanel
45
- ><DBTabPanel>Tab Panel 3</DBTabPanel></DBTabs
44
+ ><DBTabItem>Manually Tab 1</DBTabItem><DBTabItem>Manually Tab 2</DBTabItem
45
+ ><DBTabItem>Manually Tab 3</DBTabItem></DBTabList
46
+ ><DBTabPanel>Manually Panel 1</DBTabPanel
47
+ ><DBTabPanel>Manually Panel 2</DBTabPanel
48
+ ><DBTabPanel>Manually Panel 3</DBTabPanel></DBTabs
46
49
  >
47
50
  </template>
48
51
 
@@ -1,9 +1,5 @@
1
- import { ActiveProps, ChangeEventProps, ChangeEventState, GlobalProps, GlobalState, IconLeadingProps, IconProps, IconTrailingProps, InitializedState, NameProps, NameState, ShowIconLeadingProps, ShowIconProps, ShowIconTrailingProps } from '../../shared/model';
1
+ import { ActiveProps, ClickEventProps, GlobalProps, GlobalState, IconLeadingProps, IconProps, IconTrailingProps, InitializedState, ShowIconLeadingProps, ShowIconProps, ShowIconTrailingProps, WidthProps } from '../../shared/model';
2
2
  export type DBTabItemDefaultProps = {
3
- /**
4
- * To control the component
5
- */
6
- checked?: boolean | string;
7
3
  /**
8
4
  * The disabled attribute can be set to keep a user from clicking on the tab-item.
9
5
  */
@@ -16,12 +12,33 @@ export type DBTabItemDefaultProps = {
16
12
  * Define the text next to the icon specified via the icon Property to get hidden.
17
13
  */
18
14
  noText?: boolean | string;
15
+ /**
16
+ * Set the tabIndex manually (internal use for roving tabindex).
17
+ */
18
+ tabIndex?: number | string;
19
+ /**
20
+ * The id of the panel this tab controls (WAI-ARIA).
21
+ */
22
+ ariaControls?: string;
23
+ /**
24
+ * Semantic value of this tab item. When set, onIndexChange will emit this value
25
+ * (via the onValueChange event) instead of only the numeric index.
26
+ * Useful for form binding (e.g. Angular FormControl, React useState).
27
+ */
28
+ value?: string;
19
29
  };
20
- export type DBTabItemProps = GlobalProps & DBTabItemDefaultProps & IconProps & IconTrailingProps & IconLeadingProps & ShowIconLeadingProps & ShowIconTrailingProps & ActiveProps & ChangeEventProps<HTMLInputElement> & ShowIconProps & NameProps;
30
+ export type DBTabItemProps = DBTabItemDefaultProps & GlobalProps & ClickEventProps<HTMLButtonElement> & IconProps & ShowIconProps & IconTrailingProps & IconLeadingProps & ShowIconTrailingProps & ShowIconLeadingProps & ActiveProps & WidthProps;
21
31
  export type DBTabItemDefaultState = {
22
- _selected: boolean;
23
- _listenerAdded: boolean;
24
- boundSetSelectedOnChange?: (event: any) => void;
25
- setSelectedOnChange: (event: any) => void;
32
+ internalActive: boolean | undefined;
33
+ internalTabIndex: number;
34
+ getCurrentTabIndex: () => number;
35
+ _resizeObserver: ResizeObserver | null | undefined;
36
+ _ariaSelectedListener: {
37
+ fn: (event: any) => void;
38
+ } | null;
39
+ handleClick: (event: any) => void;
40
+ isTruncated: boolean;
41
+ checkTruncation: () => void;
42
+ tooltipText: string;
26
43
  };
27
- export type DBTabItemState = DBTabItemDefaultState & GlobalState & ChangeEventState<HTMLInputElement> & InitializedState & NameState;
44
+ export type DBTabItemState = DBTabItemDefaultState & GlobalState & InitializedState;
@@ -3,19 +3,13 @@ declare var __VLS_1: {};
3
3
  type __VLS_Slots = {} & {
4
4
  default?: (props: typeof __VLS_1) => any;
5
5
  };
6
- declare const __VLS_base: import("vue").DefineComponent<DBTabItemProps, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {
7
- "update:checked": (...args: any[]) => void;
8
- }, string, import("vue").PublicProps, Readonly<DBTabItemProps> & Readonly<{
9
- "onUpdate:checked"?: ((...args: any[]) => any) | undefined;
10
- }>, {
6
+ declare const __VLS_base: import("vue").DefineComponent<DBTabItemProps, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").PublicProps, Readonly<DBTabItemProps> & Readonly<{}>, {
11
7
  id: string;
12
- children: any;
13
8
  className: string;
14
- propOverrides: import("../..").PropOverridesType;
15
- name: string;
16
9
  label: string;
10
+ value: string;
17
11
  disabled: boolean | string;
18
- onChange: (event: import("../..").ChangeEvent<HTMLInputElement>) => void;
12
+ onClick: (event: import("../..").ClickEvent<HTMLButtonElement>) => void;
19
13
  icon: import("@db-ux/core-foundations").IconTypes;
20
14
  showIcon: boolean | string;
21
15
  showIconLeading: boolean | string;
@@ -23,8 +17,9 @@ declare const __VLS_base: import("vue").DefineComponent<DBTabItemProps, {}, {},
23
17
  iconLeading: import("@db-ux/core-foundations").IconTypes;
24
18
  iconTrailing: import("@db-ux/core-foundations").IconTypes;
25
19
  noText: boolean | string;
26
- checked: boolean | string;
20
+ tabIndex: number | string;
27
21
  active: boolean | string;
22
+ ariaControls: string;
28
23
  }, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>;
29
24
  declare const __VLS_export: __VLS_WithSlots<typeof __VLS_base, __VLS_Slots>;
30
25
  declare const _default: typeof __VLS_export;
@@ -1,5 +1,15 @@
1
- import { GlobalProps } from '../../shared/model';
2
- export type DBTabListDefaultProps = {};
3
- export type DBTabListProps = DBTabListDefaultProps & GlobalProps;
4
- export type DBTabListDefaultState = {};
5
- export type DBTabListState = DBTabListDefaultState;
1
+ import { GlobalProps, GlobalState, OrientationProps } from '../../shared/model';
2
+ export type DBTabListDefaultProps = {
3
+ /**
4
+ * Defines a string value that labels the current element (WAI-ARIA).
5
+ */
6
+ ariaLabel?: string;
7
+ /**
8
+ * Identifies the element (or elements) that labels the current element (WAI-ARIA).
9
+ */
10
+ ariaLabelledby?: string;
11
+ };
12
+ export type DBTabListProps = DBTabListDefaultProps & GlobalProps & OrientationProps;
13
+ export interface DBTabListState extends GlobalState {
14
+ _id?: string;
15
+ }
@@ -1,12 +1,15 @@
1
+ import { DBTabListProps } from "./model";
1
2
  declare var __VLS_1: {};
2
3
  type __VLS_Slots = {} & {
3
4
  default?: (props: typeof __VLS_1) => any;
4
5
  };
5
- declare const __VLS_base: import("vue").DefineComponent<import("../..").GlobalProps, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").PublicProps, Readonly<import("../..").GlobalProps> & Readonly<{}>, {
6
+ declare const __VLS_base: import("vue").DefineComponent<DBTabListProps, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").PublicProps, Readonly<DBTabListProps> & Readonly<{}>, {
6
7
  id: string;
7
8
  children: any;
8
9
  className: string;
9
- propOverrides: import("../..").PropOverridesType;
10
+ ariaLabel: string;
11
+ ariaLabelledby: string;
12
+ orientation: import("../..").OrientationType;
10
13
  }, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>;
11
14
  declare const __VLS_export: __VLS_WithSlots<typeof __VLS_base, __VLS_Slots>;
12
15
  declare const _default: typeof __VLS_export;
@@ -1,10 +1,20 @@
1
- import { GlobalProps, GlobalState } from '../../shared/model';
1
+ import { GlobalProps } from '../../shared/model';
2
2
  export type DBTabPanelDefaultProps = {
3
3
  /**
4
4
  * The content if you don't want to use children.
5
5
  */
6
6
  content?: string;
7
+ /**
8
+ * If the panel is hidden.
9
+ */
10
+ hidden?: boolean;
11
+ /**
12
+ * The id of the tab that labels this panel (WAI-ARIA).
13
+ */
14
+ ariaLabelledby?: string;
15
+ /**
16
+ * Accessible label for the panel, overrides ariaLabelledby for the accessible name.
17
+ */
18
+ ariaLabel?: string;
7
19
  };
8
20
  export type DBTabPanelProps = DBTabPanelDefaultProps & GlobalProps;
9
- export type DBTabPanelDefaultState = {};
10
- export type DBTabPanelState = DBTabPanelDefaultState & GlobalState;
@@ -3,13 +3,7 @@ declare var __VLS_1: {};
3
3
  type __VLS_Slots = {} & {
4
4
  default?: (props: typeof __VLS_1) => any;
5
5
  };
6
- declare const __VLS_base: import("vue").DefineComponent<DBTabPanelProps, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").PublicProps, Readonly<DBTabPanelProps> & Readonly<{}>, {
7
- id: string;
8
- children: any;
9
- className: string;
10
- propOverrides: import("../..").PropOverridesType;
11
- content: string;
12
- }, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>;
6
+ declare const __VLS_base: import("vue").DefineComponent<DBTabPanelProps, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").PublicProps, Readonly<DBTabPanelProps> & Readonly<{}>, {}, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>;
13
7
  declare const __VLS_export: __VLS_WithSlots<typeof __VLS_base, __VLS_Slots>;
14
8
  declare const _default: typeof __VLS_export;
15
9
  export default _default;
@@ -1,4 +1,4 @@
1
- import { AlignmentProps, GlobalProps, InitializedState, InputEvent, OrientationProps, WidthProps } from '../../shared/model';
1
+ import { GlobalProps, InitializedState, OrientationProps, TabItemAlignmentProps, WidthType } from '../../shared/model';
2
2
  import { DBTabItemProps } from '../tab-item/model';
3
3
  import { DBTabPanelProps } from '../tab-panel/model';
4
4
  export declare const TabsBehaviorList: readonly ["scrollbar", "arrows"];
@@ -19,6 +19,12 @@ export type DBTabsDefaultProps = {
19
19
  * Default behavior is auto selecting the first tab, change selected tab by index
20
20
  */
21
21
  initialSelectedIndex?: number | string;
22
+ /**
23
+ * Controlled active tab index. When set, the component becomes controlled:
24
+ * the consumer is responsible for updating this value in the onIndexChange handler.
25
+ * Takes precedence over initialSelectedIndex after mount.
26
+ */
27
+ activeIndex?: number | string;
22
28
  /**
23
29
  * Default behavior is auto selecting the first tab, disable it with 'manually'
24
30
  */
@@ -31,6 +37,18 @@ export type DBTabsDefaultProps = {
31
37
  * Provide simple tabs with label + text as content
32
38
  */
33
39
  tabs?: DBSimpleTabProps[] | string;
40
+ /**
41
+ * Width of the tab-items. Auto width based on tab-item size, full width based on parent elements width.
42
+ */
43
+ tabItemWidth?: WidthType | string;
44
+ /**
45
+ * Accessible label for the "scroll towards start" button (i18n). Only used with behavior="arrows".
46
+ */
47
+ scrollStartLabel?: string;
48
+ /**
49
+ * Accessible label for the "scroll towards end" button (i18n). Only used with behavior="arrows".
50
+ */
51
+ scrollEndLabel?: string;
34
52
  };
35
53
  export type DBTabsEventProps = {
36
54
  /**
@@ -42,26 +60,42 @@ export type DBTabsEventProps = {
42
60
  */
43
61
  onIndexChange?: (index?: number) => void;
44
62
  /**
45
- * Informs the user if another tab has been selected.
46
- */
47
- onTabSelect?: (event?: InputEvent<HTMLElement>) => void;
48
- /**
49
- * Informs the user if another tab has been selected.
63
+ * Fires when the active tab changes and a `value` prop is set on the tab items.
64
+ * Payload is the `value` string of the newly active tab item, or undefined
65
+ * if the tab item has no `value` prop set.
66
+ * Use this for form binding (e.g. Angular FormControl, React controlled state).
50
67
  */
51
- tabSelect?: (event?: InputEvent<HTMLElement>) => void;
68
+ onValueChange?: (value?: string) => void;
52
69
  };
53
- export type DBTabsProps = DBTabsDefaultProps & GlobalProps & OrientationProps & WidthProps & AlignmentProps & DBTabsEventProps;
70
+ export type DBTabsProps = DBTabsDefaultProps & GlobalProps & OrientationProps & TabItemAlignmentProps & DBTabsEventProps;
54
71
  export type DBTabsDefaultState = {
55
- _name: string;
56
- scrollContainer?: Element | null;
57
- scroll: (left?: boolean) => void;
58
- showScrollLeft?: boolean;
59
- showScrollRight?: boolean;
72
+ _generatedId: string;
73
+ _generatedName: string;
74
+ _id: () => string;
75
+ _name: () => string;
76
+ _getScrollContainer: () => Element | null;
77
+ scroll: (toStart?: boolean) => void;
78
+ showScrollStart?: boolean;
79
+ showScrollEnd?: boolean;
80
+ _isRtl: () => boolean;
60
81
  evaluateScrollButtons: (tabList: Element) => void;
61
- convertTabs: () => DBSimpleTabProps[];
82
+ _cachedTabs: DBSimpleTabProps[];
83
+ _updateCachedTabs: () => void;
62
84
  initTabList: () => void;
63
- initTabs: (init?: boolean) => void;
64
- handleChange: (event: InputEvent<HTMLElement>) => void;
65
- _resizeObserver?: ResizeObserver;
85
+ initTabs: (activeIndex?: number) => void;
86
+ _resizeObserver?: ResizeObserver | null;
87
+ _observer?: MutationObserver | null;
88
+ _pendingRafId: number | null;
89
+ _scrollListener: {
90
+ fn: () => void;
91
+ } | null;
92
+ activeTabIndex: number;
93
+ activateTab: (index: number) => void;
94
+ getTabId: (index: number | string) => string;
95
+ getPanelId: (index: number | string) => string;
96
+ handleClick: (event: any) => void;
97
+ handleKeyDown: (event: any) => void;
98
+ isIndexActive: (index: number | string) => boolean;
99
+ getTabItemTabIndex: (index: number | string) => 0 | -1;
66
100
  };
67
101
  export type DBTabsState = DBTabsDefaultState & InitializedState;
@@ -1,25 +1,27 @@
1
- import { InputEvent } from "../../shared/model";
2
1
  import { DBSimpleTabProps, DBTabsProps } from "./model";
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").DefineComponent<DBTabsProps, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").PublicProps, Readonly<DBTabsProps> & Readonly<{}>, {
8
7
  id: string;
9
8
  children: any;
10
9
  className: string;
11
- propOverrides: import("../../shared/model").PropOverridesType;
10
+ propOverrides: import("../..").PropOverridesType;
12
11
  name: string;
13
12
  behavior: import("./model").TabsBehaviorType;
14
- width: import("../../shared/model").WidthType | string;
15
- alignment: import("../../shared/model").AlignmentType | string;
13
+ orientation: import("../..").OrientationType;
16
14
  arrowScrollDistance: number | string;
17
15
  initialSelectedIndex: number | string;
16
+ activeIndex: number | string;
18
17
  initialSelectedMode: import("./model").TabsInitialSelectedModeType;
19
18
  tabs: DBSimpleTabProps[] | string;
20
- orientation: import("../../shared/model").OrientationType;
19
+ tabItemWidth: import("../..").WidthType | string;
20
+ scrollStartLabel: string;
21
+ scrollEndLabel: string;
22
+ tabItemAlignment: import("../..").TabItemAlignmentType | string;
21
23
  onIndexChange: (index?: number) => void;
22
- onTabSelect: (event?: InputEvent<HTMLElement>) => void;
24
+ onValueChange: (value?: string) => void;
23
25
  }, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>;
24
26
  declare const __VLS_export: __VLS_WithSlots<typeof __VLS_base, __VLS_Slots>;
25
27
  declare const _default: typeof __VLS_export;