@db-ux/react-core-components 3.0.2-shell4-bdb351c → 3.0.3

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 (115) hide show
  1. package/dist/components/brand/brand.d.ts +3 -0
  2. package/dist/components/brand/brand.js +13 -0
  3. package/dist/components/brand/index.d.ts +1 -0
  4. package/dist/components/brand/index.js +1 -0
  5. package/dist/components/brand/model.d.ts +10 -0
  6. package/dist/components/button/button.d.ts +1 -1
  7. package/dist/components/checkbox/checkbox.d.ts +1 -4
  8. package/dist/components/checkbox/checkbox.js +2 -2
  9. package/dist/components/custom-select/custom-select.d.ts +1 -4
  10. package/dist/components/custom-select/custom-select.js +7 -7
  11. package/dist/components/custom-select/model.d.ts +1 -4
  12. package/dist/components/custom-select-list-item/custom-select-list-item.d.ts +1 -4
  13. package/dist/components/drawer/drawer.js +4 -4
  14. package/dist/components/drawer/model.d.ts +1 -5
  15. package/dist/components/drawer/model.js +1 -1
  16. package/dist/components/header/header.d.ts +3 -0
  17. package/dist/components/header/header.js +67 -0
  18. package/dist/components/header/index.d.ts +1 -0
  19. package/dist/components/header/index.js +1 -0
  20. package/dist/components/header/model.d.ts +44 -0
  21. package/dist/components/input/input.d.ts +1 -4
  22. package/dist/components/input/input.js +2 -2
  23. package/dist/components/navigation/model.d.ts +5 -14
  24. package/dist/components/navigation/navigation.d.ts +1 -1
  25. package/dist/components/navigation/navigation.js +6 -96
  26. package/dist/components/navigation-item/model.d.ts +24 -9
  27. package/dist/components/navigation-item/navigation-item.d.ts +1 -1
  28. package/dist/components/navigation-item/navigation-item.js +67 -8
  29. package/dist/components/page/index.d.ts +1 -0
  30. package/dist/components/page/index.js +1 -0
  31. package/dist/components/page/model.d.ts +36 -0
  32. package/dist/components/page/model.js +2 -0
  33. package/dist/components/page/page.d.ts +3 -0
  34. package/dist/components/{shell/shell.js → page/page.js} +28 -9
  35. package/dist/components/popover/popover.js +2 -1
  36. package/dist/components/radio/radio.d.ts +1 -4
  37. package/dist/components/select/select.d.ts +1 -4
  38. package/dist/components/select/select.js +2 -2
  39. package/dist/components/switch/switch.d.ts +1 -4
  40. package/dist/components/tabs/model.d.ts +11 -3
  41. package/dist/components/tabs/tabs.d.ts +1 -1
  42. package/dist/components/tabs/tabs.js +3 -3
  43. package/dist/components/textarea/textarea.d.ts +1 -4
  44. package/dist/components/textarea/textarea.js +2 -2
  45. package/dist/components/tooltip/tooltip.js +3 -2
  46. package/dist/index.d.ts +6 -19
  47. package/dist/index.js +6 -19
  48. package/dist/shared/constants.d.ts +0 -3
  49. package/dist/shared/constants.js +0 -3
  50. package/dist/shared/model.d.ts +3 -82
  51. package/dist/shared/model.js +0 -3
  52. package/dist/utils/floating-components.d.ts +1 -17
  53. package/dist/utils/floating-components.js +48 -76
  54. package/dist/utils/navigation.d.ts +6 -2
  55. package/dist/utils/navigation.js +22 -34
  56. package/package.json +4 -4
  57. package/dist/components/control-panel-brand/control-panel-brand.d.ts +0 -3
  58. package/dist/components/control-panel-brand/control-panel-brand.js +0 -15
  59. package/dist/components/control-panel-brand/index.d.ts +0 -1
  60. package/dist/components/control-panel-brand/index.js +0 -1
  61. package/dist/components/control-panel-brand/model.d.ts +0 -5
  62. package/dist/components/control-panel-desktop/control-panel-desktop.d.ts +0 -3
  63. package/dist/components/control-panel-desktop/control-panel-desktop.js +0 -62
  64. package/dist/components/control-panel-desktop/index.d.ts +0 -1
  65. package/dist/components/control-panel-desktop/index.js +0 -1
  66. package/dist/components/control-panel-desktop/model.d.ts +0 -7
  67. package/dist/components/control-panel-flat-icon-navigation/control-panel-flat-icon-navigation.d.ts +0 -3
  68. package/dist/components/control-panel-flat-icon-navigation/control-panel-flat-icon-navigation.js +0 -26
  69. package/dist/components/control-panel-flat-icon-navigation/index.d.ts +0 -1
  70. package/dist/components/control-panel-flat-icon-navigation/index.js +0 -1
  71. package/dist/components/control-panel-flat-icon-navigation/model.d.ts +0 -7
  72. package/dist/components/control-panel-flat-icon-navigation/model.js +0 -1
  73. package/dist/components/control-panel-meta-navigation/control-panel-meta-navigation.d.ts +0 -3
  74. package/dist/components/control-panel-meta-navigation/control-panel-meta-navigation.js +0 -11
  75. package/dist/components/control-panel-meta-navigation/index.d.ts +0 -1
  76. package/dist/components/control-panel-meta-navigation/index.js +0 -1
  77. package/dist/components/control-panel-meta-navigation/model.d.ts +0 -5
  78. package/dist/components/control-panel-meta-navigation/model.js +0 -1
  79. package/dist/components/control-panel-mobile/control-panel-mobile.d.ts +0 -3
  80. package/dist/components/control-panel-mobile/control-panel-mobile.js +0 -41
  81. package/dist/components/control-panel-mobile/index.d.ts +0 -1
  82. package/dist/components/control-panel-mobile/index.js +0 -1
  83. package/dist/components/control-panel-mobile/model.d.ts +0 -30
  84. package/dist/components/control-panel-mobile/model.js +0 -1
  85. package/dist/components/control-panel-primary-actions/control-panel-primary-actions.d.ts +0 -3
  86. package/dist/components/control-panel-primary-actions/control-panel-primary-actions.js +0 -11
  87. package/dist/components/control-panel-primary-actions/index.d.ts +0 -1
  88. package/dist/components/control-panel-primary-actions/index.js +0 -1
  89. package/dist/components/control-panel-primary-actions/model.d.ts +0 -5
  90. package/dist/components/control-panel-primary-actions/model.js +0 -1
  91. package/dist/components/control-panel-secondary-actions/control-panel-secondary-actions.d.ts +0 -3
  92. package/dist/components/control-panel-secondary-actions/control-panel-secondary-actions.js +0 -11
  93. package/dist/components/control-panel-secondary-actions/index.d.ts +0 -1
  94. package/dist/components/control-panel-secondary-actions/index.js +0 -1
  95. package/dist/components/control-panel-secondary-actions/model.d.ts +0 -5
  96. package/dist/components/control-panel-secondary-actions/model.js +0 -1
  97. package/dist/components/navigation-item-group/index.d.ts +0 -1
  98. package/dist/components/navigation-item-group/index.js +0 -1
  99. package/dist/components/navigation-item-group/model.d.ts +0 -26
  100. package/dist/components/navigation-item-group/model.js +0 -1
  101. package/dist/components/navigation-item-group/navigation-item-group.d.ts +0 -3
  102. package/dist/components/navigation-item-group/navigation-item-group.js +0 -100
  103. package/dist/components/shell/index.d.ts +0 -1
  104. package/dist/components/shell/index.js +0 -1
  105. package/dist/components/shell/model.d.ts +0 -50
  106. package/dist/components/shell/model.js +0 -1
  107. package/dist/components/shell/shell.d.ts +0 -3
  108. package/dist/components/shell-sub-navigation/index.d.ts +0 -1
  109. package/dist/components/shell-sub-navigation/index.js +0 -1
  110. package/dist/components/shell-sub-navigation/model.d.ts +0 -5
  111. package/dist/components/shell-sub-navigation/model.js +0 -1
  112. package/dist/components/shell-sub-navigation/shell-sub-navigation.d.ts +0 -3
  113. package/dist/components/shell-sub-navigation/shell-sub-navigation.js +0 -45
  114. /package/dist/components/{control-panel-brand → brand}/model.js +0 -0
  115. /package/dist/components/{control-panel-desktop → header}/model.js +0 -0
@@ -88,10 +88,6 @@ export type MarginProps = {
88
88
  */
89
89
  margin?: MarginType;
90
90
  };
91
- export declare const ShellControlPanelDesktopPosition: readonly ["top", "left"];
92
- export type ShellControlPanelDesktopPositionType = (typeof ShellControlPanelDesktopPosition)[number];
93
- export declare const ShellControlPanelMobilePosition: readonly ["top", "bottom"];
94
- export type ShellControlPanelMobilePositionType = (typeof ShellControlPanelMobilePosition)[number];
95
91
  export declare const PlacementHorizontalList: readonly ["left", "right", "left-start", "left-end", "right-start", "right-end"];
96
92
  export type PlacementHorizontalType = (typeof PlacementHorizontalList)[number];
97
93
  export declare const PlacementVerticalList: readonly ["top", "bottom", "top-start", "top-end", "bottom-start", "bottom-end"];
@@ -237,13 +233,11 @@ export type ValueProps = {
237
233
  */
238
234
  value?: any;
239
235
  };
240
- export type DisabledProps = {
236
+ export type BaseFormProps = {
241
237
  /**
242
- * The disabled attribute can be set to keep a user from clicking on the item.
238
+ * The disabled attribute can be set to keep a user from clicking on the form element.
243
239
  */
244
240
  disabled?: boolean | string;
245
- };
246
- export type BaseFormProps = {
247
241
  /**
248
242
  * The label attribute specifies the caption of the form element.
249
243
  */
@@ -252,7 +246,7 @@ export type BaseFormProps = {
252
246
  * The name attribute gives the name of the form control, as used in form submission and in the form element's elements object.
253
247
  */
254
248
  name?: string;
255
- } & DisabledProps;
249
+ };
256
250
  export type CustomFormProps = {
257
251
  /**
258
252
  * Overwrites auto handling for aria-describedby.
@@ -512,83 +506,10 @@ export type AriaControlsProps = {
512
506
  */
513
507
  controls?: string;
514
508
  };
515
- export type ControlPanelProps = {
516
- /**
517
- * Slot to pass in the DBControlPanelBrand component
518
- */
519
- brand?: any;
520
- /**
521
- * Slot to pass in a meta navigation.
522
- * Desktop: Above the regular control-panel-desktop
523
- * Mobile: Inside the drawer
524
- */
525
- metaNavigation?: any;
526
- /**
527
- * Slot to pass one or more elements like DBButton (e.g. search) as primary action.
528
- * Desktop: Shown next to the main-navigation
529
- * Mobile: Shown next to the control-panel-brand
530
- */
531
- primaryActions?: any;
532
- /**
533
- * Slot to pass one or more elements like DBButton (e.g. profile, language, etc.) as secondary action.
534
- * Desktop: Shown seperated by divider at the end of the control-panel-desktop
535
- * Mobile: Shown inside the drawer at the bottom.
536
- */
537
- secondaryActions?: any;
538
- /**
539
- * Adds ``aria-labelledby`` to the <nav> element.
540
- */
541
- navigationLabeledBy?: string;
542
- };
543
509
  export type ValueLabelType = {
544
510
  value: string;
545
511
  label?: string;
546
512
  };
547
- export type OverflowScrollButtonProps = {
548
- /**
549
- * Change amount of distance if you click on an arrow, only available with behavior="arrows"
550
- */
551
- arrowScrollDistance?: number | string;
552
- };
553
- export type OverflowScrollButtonState = {
554
- scroll: (left?: boolean) => void;
555
- showScrollLeft?: boolean;
556
- showScrollRight?: boolean;
557
- evaluateScrollButtons: (tabList: Element) => void;
558
- };
559
- export type SidebarProps = {
560
- /**
561
- * Set the expanded/collapsed state initially for the left sidebar
562
- */
563
- expanded?: boolean | string;
564
- /**
565
- * Set the tooltip for the expand/collapse button
566
- */
567
- expandButtonTooltip?: string;
568
- /**
569
- * Set the tooltip for the expand/collapse button based on the state. (only react|vue)
570
- */
571
- expandButtonTooltipFn?: (open: boolean) => string;
572
- /**
573
- * Set the tooltip for the expand/collapse button based on the state. (only react|vue)
574
- */
575
- onExpandButtonTooltipFn?: (open: boolean) => string;
576
- };
577
- export type SidebarState = {
578
- _open: boolean;
579
- getToggleButtonText: () => string;
580
- };
581
- export declare const NavigationItemGroupVariantList: readonly ["popover", "tree"];
582
- export type NavigationItemGroupVariantType = (typeof NavigationItemGroupVariantList)[number];
583
- export type NavigationItemGroupVariant = {
584
- variant?: NavigationItemGroupVariantType;
585
- };
586
- export type AdditionalInformationSlotProps = {
587
- /**
588
- * Slot to add additional information most likely a DBBadge
589
- */
590
- additionalInformation?: any;
591
- };
592
513
  export type DocumentScrollState = {
593
514
  _documentScrollListenerCallbackId?: string;
594
515
  handleDocumentScroll: (event: any, parent?: HTMLElement) => void;
@@ -1,8 +1,6 @@
1
1
  export const SemanticList = ['adaptive', 'neutral', 'critical', 'informational', 'warning', 'successful'];
2
2
  export const SpacingList = ['medium', 'small', 'large', 'none'];
3
3
  export const MarginList = ['medium', 'small', 'large', 'none'];
4
- export const ShellControlPanelDesktopPosition = ['top', 'left'];
5
- export const ShellControlPanelMobilePosition = ['top', 'bottom'];
6
4
  export const PlacementHorizontalList = ['left', 'right', 'left-start', 'left-end', 'right-start', 'right-end'];
7
5
  export const PlacementVerticalList = ['top', 'bottom', 'top-start', 'top-end', 'bottom-start', 'bottom-end'];
8
6
  export const PlacementList = [...PlacementHorizontalList, ...PlacementVerticalList];
@@ -21,4 +19,3 @@ export const AutoCompleteList = ['off', 'on', 'name', 'honorific-prefix', 'given
21
19
  export const LinkTargetList = ['_self', '_blank', '_parent', '_top'];
22
20
  export const LinkReferrerPolicyList = ['no-referrer', 'no-referrer-when-downgrade', 'origin', 'origin-when-cross-origin', 'same-origin', 'strict-origin', 'strict-origin-when-cross-origin', 'unsafe-url'];
23
21
  export const AlignmentList = ['start', 'center'];
24
- export const NavigationItemGroupVariantList = ['popover', 'tree'];
@@ -16,21 +16,5 @@ export declare const getFloatingProps: (element: HTMLElement, parent: HTMLElemen
16
16
  correctedPlacement: string;
17
17
  innerWidth: number;
18
18
  innerHeight: number;
19
- outsideYBoth?: undefined;
20
- outsideXBoth?: undefined;
21
- } | {
22
- top: number;
23
- bottom: number;
24
- right: number;
25
- height: number;
26
- width: number;
27
- left: number;
28
- childHeight: number;
29
- childWidth: number;
30
- correctedPlacement: string;
31
- innerWidth: number;
32
- innerHeight: number;
33
- outsideYBoth: boolean;
34
- outsideXBoth: boolean;
35
19
  };
36
- export declare const handleFixedPopover: (element: HTMLElement, parent: HTMLElement, placement?: string) => void;
20
+ export declare const handleFixedPopover: (element: HTMLElement, parent: HTMLElement, placement: string) => void;
@@ -60,11 +60,9 @@ export const handleDataOutside = (el) => {
60
60
  return dataOutsidePair;
61
61
  };
62
62
  export const handleFixedDropdown = (element, parent, placement) => {
63
- // We skip this if we are in mobile it's already fixed or if we don't have a floating dropdown
64
- const computedStyle = getComputedStyle(element);
65
- if (computedStyle.zIndex === '9999' || computedStyle.position !== 'fixed' && computedStyle.position !== 'absolute') {
63
+ // We skip this if we are in mobile it's already fixed
64
+ if (getComputedStyle(element).zIndex === '9999')
66
65
  return;
67
- }
68
66
  const { top, bottom, childHeight, childWidth, width, right, left, correctedPlacement } = getFloatingProps(element, parent, placement);
69
67
  const fullWidth = element.dataset['width'] === 'full';
70
68
  if (fullWidth) {
@@ -106,29 +104,27 @@ export const getFloatingProps = (element, parent, placement) => {
106
104
  let childHeight = childRect.height;
107
105
  let childWidth = childRect.width;
108
106
  if (placement === 'bottom' || placement === 'top') {
109
- childWidth = width > childWidth ? 0 : childWidth / 2;
107
+ childWidth = childWidth / 2;
110
108
  }
111
109
  if (placement === 'left' || placement === 'right') {
112
- childHeight = height > childHeight ? 0 : childHeight / 2;
110
+ childHeight = childHeight / 2;
113
111
  }
114
- const outsideBottom = Math.floor(bottom + childHeight) > innerHeight;
115
- const outsideTop = Math.ceil(top - childHeight) < 0;
116
- const outsideLeft = Math.ceil(left - childWidth) < 0;
117
- const outsideRight = Math.floor(right + childWidth) > innerWidth;
112
+ const outsideBottom = bottom + childHeight > innerHeight;
113
+ const outsideTop = top - childHeight < 0;
114
+ const outsideLeft = left - childWidth < 0;
115
+ const outsideRight = right + childWidth > innerWidth;
118
116
  let correctedPlacement = placement;
119
117
  if (placement.startsWith('bottom')) {
120
118
  if (outsideBottom) {
121
- if (!outsideTop) {
122
- correctedPlacement = placement === null || placement === void 0 ? void 0 : placement.replace('bottom', 'top');
123
- if (outsideLeft && outsideRight) {
124
- correctedPlacement = 'top';
125
- }
126
- else if (outsideLeft) {
127
- correctedPlacement = 'top-start';
128
- }
129
- else if (outsideRight) {
130
- correctedPlacement = 'top-end';
131
- }
119
+ correctedPlacement = placement === null || placement === void 0 ? void 0 : placement.replace('bottom', 'top');
120
+ if (outsideLeft && outsideRight) {
121
+ correctedPlacement = 'top';
122
+ }
123
+ else if (outsideLeft) {
124
+ correctedPlacement = 'top-start';
125
+ }
126
+ else if (outsideRight) {
127
+ correctedPlacement = 'top-end';
132
128
  }
133
129
  }
134
130
  else {
@@ -145,17 +141,15 @@ export const getFloatingProps = (element, parent, placement) => {
145
141
  }
146
142
  else if (placement.startsWith('top')) {
147
143
  if (outsideTop) {
148
- if (!outsideBottom) {
149
- correctedPlacement = placement === null || placement === void 0 ? void 0 : placement.replace('top', 'bottom');
150
- if (outsideLeft && outsideRight) {
151
- correctedPlacement = 'bottom';
152
- }
153
- else if (outsideLeft) {
154
- correctedPlacement = 'bottom-start';
155
- }
156
- else if (outsideRight) {
157
- correctedPlacement = 'bottom-end';
158
- }
144
+ correctedPlacement = placement === null || placement === void 0 ? void 0 : placement.replace('top', 'bottom');
145
+ if (outsideLeft && outsideRight) {
146
+ correctedPlacement = 'bottom';
147
+ }
148
+ else if (outsideLeft) {
149
+ correctedPlacement = 'bottom-start';
150
+ }
151
+ else if (outsideRight) {
152
+ correctedPlacement = 'bottom-end';
159
153
  }
160
154
  }
161
155
  else {
@@ -172,17 +166,15 @@ export const getFloatingProps = (element, parent, placement) => {
172
166
  }
173
167
  else if (placement.startsWith('left')) {
174
168
  if (outsideLeft) {
175
- if (outsideRight) {
176
- correctedPlacement = placement === null || placement === void 0 ? void 0 : placement.replace('left', 'right');
177
- if (outsideBottom && outsideTop) {
178
- correctedPlacement = 'right';
179
- }
180
- else if (outsideBottom) {
181
- correctedPlacement = 'right-end';
182
- }
183
- else if (outsideTop) {
184
- correctedPlacement = 'right-start';
185
- }
169
+ correctedPlacement = placement === null || placement === void 0 ? void 0 : placement.replace('left', 'right');
170
+ if (outsideBottom && outsideTop) {
171
+ correctedPlacement = 'right';
172
+ }
173
+ else if (outsideBottom) {
174
+ correctedPlacement = 'right-end';
175
+ }
176
+ else if (outsideTop) {
177
+ correctedPlacement = 'right-start';
186
178
  }
187
179
  }
188
180
  else {
@@ -199,17 +191,15 @@ export const getFloatingProps = (element, parent, placement) => {
199
191
  }
200
192
  else if (correctedPlacement.startsWith('right')) {
201
193
  if (outsideRight) {
202
- if (!outsideLeft) {
203
- correctedPlacement = placement === null || placement === void 0 ? void 0 : placement.replace('right', 'left');
204
- if (outsideBottom && outsideTop) {
205
- correctedPlacement = 'left';
206
- }
207
- else if (outsideBottom) {
208
- correctedPlacement = 'left-end';
209
- }
210
- else if (outsideTop) {
211
- correctedPlacement = 'left-start';
212
- }
194
+ correctedPlacement = placement === null || placement === void 0 ? void 0 : placement.replace('right', 'left');
195
+ if (outsideBottom && outsideTop) {
196
+ correctedPlacement = 'left';
197
+ }
198
+ else if (outsideBottom) {
199
+ correctedPlacement = 'left-end';
200
+ }
201
+ else if (outsideTop) {
202
+ correctedPlacement = 'left-start';
213
203
  }
214
204
  }
215
205
  else {
@@ -235,24 +225,13 @@ export const getFloatingProps = (element, parent, placement) => {
235
225
  childWidth: childRect.width,
236
226
  correctedPlacement,
237
227
  innerWidth,
238
- innerHeight,
239
- outsideYBoth: outsideTop && outsideBottom,
240
- outsideXBoth: outsideRight && outsideLeft
228
+ innerHeight
241
229
  };
242
230
  };
243
231
  export const handleFixedPopover = (element, parent, placement) => {
244
- var _a, _b, _c;
245
- const computedStyle = getComputedStyle(element);
246
- // We skip if we don't have a floating popover
247
- if (computedStyle.position !== 'fixed' && computedStyle.position !== 'absolute') {
248
- return;
249
- }
250
- let distance = computedStyle.getPropertyValue('--db-popover-distance');
251
- if (!distance.length) {
252
- distance = '0px';
253
- }
254
- const elementPlacement = (_c = (_b = (_a = element === null || element === void 0 ? void 0 : element.dataset) === null || _a === void 0 ? void 0 : _a['placement']) !== null && _b !== void 0 ? _b : placement) !== null && _c !== void 0 ? _c : 'bottom';
255
- const { top, height, width, childHeight, childWidth, right, left, bottom, correctedPlacement, innerWidth, innerHeight, outsideYBoth } = getFloatingProps(element, parent, elementPlacement);
232
+ var _a;
233
+ const distance = (_a = getComputedStyle(element).getPropertyValue('--db-popover-distance')) !== null && _a !== void 0 ? _a : '0px';
234
+ const { top, height, width, childHeight, childWidth, right, left, bottom, correctedPlacement, innerWidth, innerHeight } = getFloatingProps(element, parent, placement);
256
235
  // Tooltip arrow position
257
236
  if (childWidth > width && (correctedPlacement.startsWith('bottom') || correctedPlacement.startsWith('top'))) {
258
237
  const diff = width / 2 / childWidth * 100;
@@ -321,13 +300,6 @@ export const handleFixedPopover = (element, parent, placement) => {
321
300
  element.style.insetBlockStart = `calc(${bottom}px + ${distance})`;
322
301
  element.style.insetBlockEnd = `calc(${end > innerHeight ? innerHeight : end}px + ${distance})`;
323
302
  }
324
- // In this case we are outside of top and bottom so we need to scroll
325
- // We use the full height in this case
326
- if (outsideYBoth) {
327
- element.style.overflow = 'hidden auto';
328
- element.style.insetBlock = distance;
329
- element.style.maxBlockSize = `calc(${innerHeight}px - 2 * ${distance})`;
330
- }
331
303
  element.style.position = 'fixed';
332
304
  element.dataset['correctedPlacement'] = correctedPlacement;
333
305
  };
@@ -23,6 +23,10 @@ export declare class NavigationItemSafeTriangle {
23
23
  private getTriangleTipY;
24
24
  private hasMouseEnteredSubNavigation;
25
25
  private getTriangleCoordinates;
26
- followByMouseEvent(event: any): void;
26
+ followByMouseEvent(event: MouseEvent): void;
27
27
  }
28
- export declare const handleSubNavigationPosition: (element: HTMLElement, level?: number) => void;
28
+ declare const _default: {
29
+ isEventTargetNavigationItem: (event: unknown) => boolean;
30
+ NavigationItemSafeTriangle: typeof NavigationItemSafeTriangle;
31
+ };
32
+ export default _default;
@@ -1,12 +1,12 @@
1
- import { handleDataOutside, handleFixedPopover } from './floating-components';
1
+ import { handleDataOutside } from './floating-components';
2
2
  export const isEventTargetNavigationItem = (event) => {
3
- var _a;
3
+ var _a, _b;
4
4
  const { target } = event;
5
- return Boolean((_a = target === null || target === void 0 ? void 0 : target.parentElement) === null || _a === void 0 ? void 0 : _a.classList.contains('db-navigation-item'));
5
+ return Boolean(!((_a = target === null || target === void 0 ? void 0 : target.classList) === null || _a === void 0 ? void 0 : _a.contains('db-navigation-item-expand-button')) && ((_b = target === null || target === void 0 ? void 0 : target.parentElement) === null || _b === void 0 ? void 0 : _b.classList.contains('db-navigation-item')));
6
6
  };
7
7
  export class NavigationItemSafeTriangle {
8
8
  constructor(element, subNavigation) {
9
- var _a, _b;
9
+ var _a;
10
10
  this.parentSubNavigation = null;
11
11
  this.initialized = false;
12
12
  this.mouseX = 0;
@@ -16,12 +16,13 @@ export class NavigationItemSafeTriangle {
16
16
  if (!this.element || !this.subNavigation) {
17
17
  return;
18
18
  }
19
- this.parentSubNavigation = (_b = (_a = this.element) === null || _a === void 0 ? void 0 : _a.closest('.db-navigation-item-group-menu')) !== null && _b !== void 0 ? _b : this.element;
19
+ this.parentSubNavigation = (_a = this.element) === null || _a === void 0 ? void 0 : _a.closest('.db-sub-navigation');
20
20
  /*
21
21
  * only initiate if:
22
+ * 1. item is not at root navigation level
22
23
  * 2. item is not in the mobile navigation / within db-drawer
23
24
  */
24
- if (!this.element.closest('.db-drawer')) {
25
+ if (this.parentSubNavigation && !this.element.closest('.db-drawer')) {
25
26
  this.init();
26
27
  }
27
28
  }
@@ -87,10 +88,20 @@ export class NavigationItemSafeTriangle {
87
88
  }
88
89
  return false;
89
90
  }
90
- getTriangleCoordinates() {
91
+ getTriangleCoordinates(variant) {
91
92
  if (!this.triangleData) {
92
93
  return;
93
94
  }
95
+ if (variant === 'fill-gap') {
96
+ const itemHeight = `${this.triangleData.itemRect.height + 2 * this.triangleData.padding}px`;
97
+ const xStart = `${this.triangleData.parentElementWidth - this.triangleData.padding}px`;
98
+ return {
99
+ lb: `${xStart} ${itemHeight}`,
100
+ lt: `${xStart} 0`,
101
+ rt: '100% 0',
102
+ rb: `100% ${itemHeight}`
103
+ };
104
+ }
94
105
  const tipX = this.getTriangleTipX();
95
106
  const tipY = this.getTriangleTipY();
96
107
  const lb = `${tipX}px ${tipY}px`;
@@ -109,7 +120,7 @@ export class NavigationItemSafeTriangle {
109
120
  this.mouseX = event.clientX - this.triangleData.itemRect.left;
110
121
  this.mouseY = event.clientY - this.triangleData.itemRect.top;
111
122
  const isOverSubNavigation = this.hasMouseEnteredSubNavigation();
112
- const coordinates = this.getTriangleCoordinates();
123
+ const coordinates = this.getTriangleCoordinates(isOverSubNavigation ? 'fill-gap' : 'safe-triangle');
113
124
  if (!coordinates) {
114
125
  return;
115
126
  }
@@ -119,30 +130,7 @@ export class NavigationItemSafeTriangle {
119
130
  }
120
131
  }
121
132
  }
122
- export const handleSubNavigationPosition = (element, level = 0) => {
123
- for (const navItem of Array.from(element.querySelectorAll('.db-navigation-item-group'))) {
124
- const subNavigation = navItem.querySelector('.db-navigation-item-group-menu');
125
- const button = navItem.querySelector('.db-navigation-item-group-expand-button');
126
- if (subNavigation && button) {
127
- /*
128
- * This is set via css inside:
129
- * `packages/components/src/components/navigation-item-group/navigation-item-group-menu-popover.scss`.
130
- * We don't need to calculate the position of the menu as a popover.
131
- */
132
- const isMobile = getComputedStyle(subNavigation).getPropertyValue('--db-navigation-item-group-menu-mobile');
133
- if (isMobile)
134
- return;
135
- if (level > 0 || subNavigation.dataset['open'] === 'horizontal') {
136
- // Sub-Navigation should be opened horizontal
137
- handleFixedPopover(subNavigation, button, 'right-start');
138
- subNavigation.dataset['open'] = 'horizontal';
139
- }
140
- else {
141
- // Sub-Navigation should be opened vertical
142
- handleFixedPopover(subNavigation, button, 'bottom-start');
143
- subNavigation.dataset['open'] = 'vertical';
144
- }
145
- handleSubNavigationPosition(subNavigation, level + 1);
146
- }
147
- }
133
+ export default {
134
+ isEventTargetNavigationItem,
135
+ NavigationItemSafeTriangle
148
136
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@db-ux/react-core-components",
3
- "version": "3.0.2-shell4-bdb351c",
3
+ "version": "3.0.3",
4
4
  "description": "React components for @db-ux/core-components",
5
5
  "repository": {
6
6
  "type": "git",
@@ -27,7 +27,7 @@
27
27
  "tsc": "tsc --project . --sourceMap false"
28
28
  },
29
29
  "devDependencies": {
30
- "@playwright/experimental-ct-react": "1.54.1",
30
+ "@playwright/experimental-ct-react": "1.54.2",
31
31
  "@types/react": "18.3.13",
32
32
  "react": "18.3.1",
33
33
  "react-dom": "18.3.1"
@@ -38,7 +38,7 @@
38
38
  },
39
39
  "sideEffects": false,
40
40
  "dependencies": {
41
- "@db-ux/core-components": "3.0.2-shell4-bdb351c",
42
- "@db-ux/core-foundations": "3.0.2-shell4-bdb351c"
41
+ "@db-ux/core-components": "3.0.3",
42
+ "@db-ux/core-foundations": "3.0.3"
43
43
  }
44
44
  }
@@ -1,3 +0,0 @@
1
- import * as React from "react";
2
- declare const DBControlPanelBrand: React.ForwardRefExoticComponent<Omit<React.HTMLAttributes<any>, "text" | "icon" | keyof import("../..").GlobalProps | "showIcon" | "additionalInformation"> & import("../..").GlobalProps & import("../..").IconProps & import("../..").ShowIconProps & import("../..").TextProps & import("../..").AdditionalInformationSlotProps & React.RefAttributes<any>>;
3
- export default DBControlPanelBrand;
@@ -1,15 +0,0 @@
1
- "use client";
2
- import * as React from "react";
3
- import { filterPassingProps, getRootProps } from "../../utils/react";
4
- import { useRef, forwardRef } from "react";
5
- import { DEFAULT_ICON } from "../../shared/constants";
6
- import { cls, getBooleanAsString } from "../../utils";
7
- function DBControlPanelBrandFn(props, component) {
8
- var _a;
9
- const _ref = component || useRef(component);
10
- return (React.createElement("div", Object.assign({ ref: _ref }, filterPassingProps(props, ["data-icon-variant", "data-icon-variant-before", "data-icon-variant-after", "data-icon-weight", "data-icon-weight-before", "data-icon-weight-after", "data-interactive", "data-force-mobile", "data-color", "data-container-color", "data-bg-color", "data-on-bg-color", "data-color-scheme", "data-font-size", "data-headline-size", "data-divider", "data-focus", "data-font"]), { "data-icon": (_a = props.icon) !== null && _a !== void 0 ? _a : DEFAULT_ICON, "data-show-icon": getBooleanAsString(props.showIcon), id: props.id }, getRootProps(props, ["data-icon-variant", "data-icon-variant-before", "data-icon-variant-after", "data-icon-weight", "data-icon-weight-before", "data-icon-weight-after", "data-interactive", "data-force-mobile", "data-color", "data-container-color", "data-bg-color", "data-on-bg-color", "data-color-scheme", "data-font-size", "data-headline-size", "data-divider", "data-focus", "data-font"]), { className: cls("db-control-panel-brand", props.className) }),
11
- props.text ? React.createElement(React.Fragment, null, props.text) : React.createElement(React.Fragment, null, props.children),
12
- React.createElement(React.Fragment, null, props.additionalInformation)));
13
- }
14
- const DBControlPanelBrand = forwardRef(DBControlPanelBrandFn);
15
- export default DBControlPanelBrand;
@@ -1 +0,0 @@
1
- export { default as DBControlPanelBrand } from './control-panel-brand';
@@ -1 +0,0 @@
1
- export { default as DBControlPanelBrand } from './control-panel-brand';
@@ -1,5 +0,0 @@
1
- import { AdditionalInformationSlotProps, GlobalProps, GlobalState, IconProps, ShowIconProps, TextProps } from '../../shared/model';
2
- export type DBControlPanelBrandDefaultProps = {};
3
- export type DBControlPanelBrandProps = DBControlPanelBrandDefaultProps & GlobalProps & IconProps & ShowIconProps & TextProps & AdditionalInformationSlotProps;
4
- export type DBControlPanelBrandDefaultState = {};
5
- export type DBControlPanelBrandState = DBControlPanelBrandDefaultState & GlobalState;
@@ -1,3 +0,0 @@
1
- import * as React from "react";
2
- declare const DBControlPanelDesktop: React.ForwardRefExoticComponent<Omit<React.HTMLAttributes<any>, "width" | "orientation" | keyof import("../..").GlobalProps | keyof import("../..").ControlPanelProps | keyof import("../..").SidebarProps> & import("../..").GlobalProps & import("../..").ContainerWidthProps & import("../..").ControlPanelProps & import("../..").OrientationProps & import("../..").SidebarProps & React.RefAttributes<any>>;
3
- export default DBControlPanelDesktop;
@@ -1,62 +0,0 @@
1
- "use client";
2
- import * as React from "react";
3
- import { filterPassingProps, getRootProps } from "../../utils/react";
4
- import { useState, useRef, forwardRef } from "react";
5
- import { DEFAULT_COLLAPSE, DEFAULT_EXPAND } from "../../shared/constants";
6
- import { cls, getBoolean, getBooleanAsString, uuid } from "../../utils";
7
- import { handleSubNavigationPosition } from "../../utils/navigation";
8
- import DBButton from "../button/button";
9
- import DBTooltip from "../tooltip/tooltip";
10
- function DBControlPanelDesktopFn(props, component) {
11
- var _a, _b, _c;
12
- const _ref = component || useRef(component);
13
- const _scrollContainerRef = useRef(null);
14
- const [_id, set_id] = useState(() => `db-control-panel-desktop-${uuid()}`);
15
- const [_open, set_open] = useState(() => true);
16
- function handleToggle(event) {
17
- if (typeof event.detail !== "object") {
18
- event.stopPropagation();
19
- set_open(!_open);
20
- }
21
- }
22
- function getToggleButtonText() {
23
- if (props.onExpandButtonTooltipFn) {
24
- const open = _open;
25
- return props.onExpandButtonTooltipFn(open);
26
- }
27
- if (props.expandButtonTooltip) {
28
- return props.expandButtonTooltip;
29
- }
30
- return _open ? DEFAULT_COLLAPSE : DEFAULT_EXPAND;
31
- }
32
- function onScroll() {
33
- if (!_scrollContainerRef.current)
34
- return;
35
- const popoverNavigation = _scrollContainerRef.current.querySelector('.db-navigation[data-variant="popover"]');
36
- if (!popoverNavigation)
37
- return;
38
- const navigationMenu = popoverNavigation.querySelector("menu");
39
- if (navigationMenu) {
40
- handleSubNavigationPosition(navigationMenu);
41
- }
42
- }
43
- const hasInitialized = useRef(false);
44
- if (!hasInitialized.current) {
45
- if (props.expanded !== undefined) {
46
- set_open((_a = getBoolean(props.expanded, "expanded")) !== null && _a !== void 0 ? _a : true);
47
- }
48
- hasInitialized.current = true;
49
- }
50
- return (React.createElement("header", Object.assign({ ref: _ref }, filterPassingProps(props, ["data-icon-variant", "data-icon-variant-before", "data-icon-variant-after", "data-icon-weight", "data-icon-weight-before", "data-icon-weight-after", "data-interactive", "data-force-mobile", "data-color", "data-container-color", "data-bg-color", "data-on-bg-color", "data-color-scheme", "data-font-size", "data-headline-size", "data-divider", "data-focus", "data-font", "onToggle"]), getRootProps(props, ["data-icon-variant", "data-icon-variant-before", "data-icon-variant-after", "data-icon-weight", "data-icon-weight-before", "data-icon-weight-after", "data-interactive", "data-force-mobile", "data-color", "data-container-color", "data-bg-color", "data-on-bg-color", "data-color-scheme", "data-font-size", "data-headline-size", "data-divider", "data-focus", "data-font"]), { className: cls("db-control-panel-desktop", props.className), id: (_b = props.id) !== null && _b !== void 0 ? _b : _id, "data-width": props.width, "data-orientation": props.orientation, "data-open": getBooleanAsString(_open) }),
51
- React.createElement(React.Fragment, null, props.brand),
52
- React.createElement("div", { className: "db-control-panel-desktop-scroll-container", ref: _scrollContainerRef, onScroll: (event) => onScroll() },
53
- props.children,
54
- React.createElement(React.Fragment, null, props.metaNavigation)),
55
- React.createElement(React.Fragment, null, props.primaryActions),
56
- React.createElement(React.Fragment, null, props.secondaryActions),
57
- React.createElement("div", { className: "db-control-panel-desktop-button" },
58
- React.createElement(DBButton, { variant: "ghost", type: "button", icon: "double_chevron_left", onClick: (event) => handleToggle(event), "aria-controls": (_c = props.id) !== null && _c !== void 0 ? _c : _id, "aria-expanded": _open, noText: true },
59
- React.createElement(DBTooltip, { variant: "label", placement: "right" }, getToggleButtonText())))));
60
- }
61
- const DBControlPanelDesktop = forwardRef(DBControlPanelDesktopFn);
62
- export default DBControlPanelDesktop;
@@ -1 +0,0 @@
1
- export { default as DBControlPanelDesktop } from './control-panel-desktop';
@@ -1 +0,0 @@
1
- export { default as DBControlPanelDesktop } from './control-panel-desktop';
@@ -1,7 +0,0 @@
1
- import { ContainerWidthProps, ControlPanelProps, GlobalProps, GlobalState, OrientationProps, SidebarProps, SidebarState, ToggleEventState } from '../../shared/model';
2
- export type DBControlPanelDesktopDefaultProps = {};
3
- export type DBControlPanelDesktopProps = DBControlPanelDesktopDefaultProps & GlobalProps & ContainerWidthProps & ControlPanelProps & OrientationProps & SidebarProps;
4
- export type DBControlPanelDesktopDefaultState = {
5
- onScroll: () => void;
6
- };
7
- export type DBControlPanelDesktopState = DBControlPanelDesktopDefaultState & GlobalState & ToggleEventState<HTMLButtonElement> & SidebarState;
@@ -1,3 +0,0 @@
1
- import * as React from "react";
2
- declare const DBControlPanelFlatIconNavigation: React.ForwardRefExoticComponent<Omit<React.HTMLAttributes<any>, keyof import("../..").GlobalProps | "noText"> & import("./model").DBControlPanelFlatIconNavigationDefaultProps & import("../..").GlobalProps & React.RefAttributes<any>>;
3
- export default DBControlPanelFlatIconNavigation;
@@ -1,26 +0,0 @@
1
- "use client";
2
- import * as React from "react";
3
- import { filterPassingProps, getRootProps } from "../../utils/react";
4
- import { useState, useRef, useEffect, forwardRef } from "react";
5
- import { cls, getBooleanAsString } from "../../utils";
6
- function DBControlPanelFlatIconNavigationFn(props, component) {
7
- const _ref = component || useRef(undefined);
8
- const [initialized, setInitialized] = useState(() => false);
9
- useEffect(() => {
10
- setInitialized(true);
11
- }, []);
12
- useEffect(() => {
13
- if (_ref.current && initialized) {
14
- const tooltips = _ref.current.querySelectorAll(".db-tooltip");
15
- if ((tooltips === null || tooltips === void 0 ? void 0 : tooltips.length) > 0) {
16
- const array = Array.from(tooltips);
17
- for (const tooltip of array) {
18
- tooltip.dataset["placement"] = "top";
19
- }
20
- }
21
- }
22
- }, [_ref.current, initialized]);
23
- return (React.createElement("div", Object.assign({ ref: _ref }, filterPassingProps(props, ["data-icon-variant", "data-icon-variant-before", "data-icon-variant-after", "data-icon-weight", "data-icon-weight-before", "data-icon-weight-after", "data-interactive", "data-force-mobile", "data-color", "data-container-color", "data-bg-color", "data-on-bg-color", "data-color-scheme", "data-font-size", "data-headline-size", "data-divider", "data-focus", "data-font"]), { id: props.id, "data-no-text": getBooleanAsString(props.noText) }, getRootProps(props, ["data-icon-variant", "data-icon-variant-before", "data-icon-variant-after", "data-icon-weight", "data-icon-weight-before", "data-icon-weight-after", "data-interactive", "data-force-mobile", "data-color", "data-container-color", "data-bg-color", "data-on-bg-color", "data-color-scheme", "data-font-size", "data-headline-size", "data-divider", "data-focus", "data-font"]), { className: cls("db-control-panel-flat-icon-navigation", props.className) }), props.children));
24
- }
25
- const DBControlPanelFlatIconNavigation = forwardRef(DBControlPanelFlatIconNavigationFn);
26
- export default DBControlPanelFlatIconNavigation;
@@ -1 +0,0 @@
1
- export { default as DBControlPanelFlatIconNavigation } from "./control-panel-flat-icon-navigation";