@genexus/genexus-ide-ui 0.0.22 → 0.0.24

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 (144) hide show
  1. package/dist/cjs/ch-action-group_2.cjs.entry.js +211 -0
  2. package/dist/cjs/ch-dropdown-item.cjs.entry.js +36 -5
  3. package/dist/cjs/ch-dropdown.cjs.entry.js +50 -52
  4. package/dist/cjs/{ch-grid_4.cjs.entry.js → ch-grid_8.cjs.entry.js} +143 -0
  5. package/dist/cjs/{ch-suggest_5.cjs.entry.js → ch-suggest_4.cjs.entry.js} +0 -65
  6. package/dist/cjs/ch-test-action-group.cjs.entry.js +79 -0
  7. package/dist/cjs/ch-test-dropdown.cjs.entry.js +54 -0
  8. package/dist/cjs/ch-window_2.cjs.entry.js +25 -6
  9. package/dist/cjs/format-date-f2c49d1a.js +28 -0
  10. package/dist/cjs/genexus-ide-ui.cjs.js +1 -1
  11. package/dist/cjs/gx-ide-team-dev-commit.cjs.entry.js +15 -35
  12. package/dist/cjs/gx-ide-team-dev-select-recent-comment.cjs.entry.js +5 -15
  13. package/dist/cjs/gx-ide-team-dev-update-partial-selection.cjs.entry.js +102 -0
  14. package/dist/cjs/gx-ide-team-dev-update-to-revision.cjs.entry.js +53 -0
  15. package/dist/cjs/gx-ide-team-dev-update.cjs.entry.js +278 -0
  16. package/dist/cjs/gx-ide-top-bar.cjs.entry.js +37 -0
  17. package/dist/cjs/{gxg-combo-box_8.cjs.entry.js → gxg-combo-box_6.cjs.entry.js} +0 -132
  18. package/dist/cjs/gxg-form-checkbox-group_2.cjs.entry.js +140 -0
  19. package/dist/cjs/{gx-ide-top-bar_2.cjs.entry.js → gxg-form-radio-group.cjs.entry.js} +0 -31
  20. package/dist/cjs/gxg-text.cjs.entry.js +72 -0
  21. package/dist/cjs/loader.cjs.js +1 -1
  22. package/dist/collection/collection-manifest.json +7 -0
  23. package/dist/collection/common/format-date.js +11 -0
  24. package/dist/collection/components/team-dev-commit/gx-ide-assets/team-dev-commit/langs/team-dev-commit.lang.en.json +1 -1
  25. package/dist/collection/components/team-dev-commit/team-dev-commit.js +35 -26
  26. package/dist/collection/components/team-dev-select-recent-comment/team-dev-select-recent-comment.js +6 -16
  27. package/dist/collection/components/team-dev-update/gx-ide-assets/team-dev-update/langs/team-dev-update.lang.en.json +45 -0
  28. package/dist/collection/components/team-dev-update/gx-ide-assets/team-dev-update/langs/team-dev-update.lang.ja.json +3 -0
  29. package/dist/collection/components/team-dev-update/gx-ide-assets/team-dev-update/langs/team-dev-update.lang.zh.json +3 -0
  30. package/dist/collection/components/team-dev-update/team-dev-update.css +216 -0
  31. package/dist/collection/components/team-dev-update/team-dev-update.js +524 -0
  32. package/dist/collection/components/team-dev-update-partial-selection/gx-ide-assets/team-dev-update-partial-selection/langs/team-dev-update-partial-selection.lang.en.json +15 -0
  33. package/dist/collection/components/team-dev-update-partial-selection/gx-ide-assets/team-dev-update-partial-selection/langs/team-dev-update-partial-selection.lang.ja.json +3 -0
  34. package/dist/collection/components/team-dev-update-partial-selection/gx-ide-assets/team-dev-update-partial-selection/langs/team-dev-update-partial-selection.lang.zh.json +3 -0
  35. package/dist/collection/components/team-dev-update-partial-selection/team-dev-update-partial-selection.css +149 -0
  36. package/dist/collection/components/team-dev-update-partial-selection/team-dev-update-partial-selection.js +238 -0
  37. package/dist/collection/components/team-dev-update-to-revision/gx-ide-assets/team-dev-update-to-revision/langs/team-dev-update-to-revision.lang.en.json +11 -0
  38. package/dist/collection/components/team-dev-update-to-revision/gx-ide-assets/team-dev-update-to-revision/langs/team-dev-update-to-revision.lang.ja.json +3 -0
  39. package/dist/collection/components/team-dev-update-to-revision/gx-ide-assets/team-dev-update-to-revision/langs/team-dev-update-to-revision.lang.zh.json +3 -0
  40. package/dist/collection/components/team-dev-update-to-revision/team-dev-update-to-revision.css +147 -0
  41. package/dist/collection/components/team-dev-update-to-revision/team-dev-update-to-revision.js +136 -0
  42. package/dist/components/action-group-item.js +54 -0
  43. package/dist/components/action-group.js +214 -0
  44. package/dist/components/ch-action-group-item.js +6 -0
  45. package/dist/components/ch-action-group.js +6 -0
  46. package/dist/components/ch-dropdown-item-separator.js +1 -28
  47. package/dist/components/ch-dropdown-item.js +1 -53
  48. package/dist/components/ch-dropdown.js +1 -284
  49. package/dist/components/ch-grid-rowset-empty.js +1 -24
  50. package/dist/components/ch-grid-rowset-empty2.js +26 -0
  51. package/dist/components/ch-test-action-group.js +137 -0
  52. package/dist/components/ch-test-dropdown.js +104 -0
  53. package/dist/components/ch-window2.js +25 -6
  54. package/dist/components/dropdown-item-separator.js +30 -0
  55. package/dist/components/dropdown-item.js +109 -0
  56. package/dist/components/dropdown.js +294 -0
  57. package/dist/components/format-date.js +25 -0
  58. package/dist/components/gx-ide-team-dev-commit.js +16 -35
  59. package/dist/components/gx-ide-team-dev-select-recent-comment.js +5 -15
  60. package/dist/components/gx-ide-team-dev-update-partial-selection.d.ts +11 -0
  61. package/dist/components/gx-ide-team-dev-update-partial-selection.js +213 -0
  62. package/dist/components/gx-ide-team-dev-update-to-revision.d.ts +11 -0
  63. package/dist/components/gx-ide-team-dev-update-to-revision.js +131 -0
  64. package/dist/components/gx-ide-team-dev-update.d.ts +11 -0
  65. package/dist/components/gx-ide-team-dev-update.js +473 -0
  66. package/dist/components/index.d.ts +3 -0
  67. package/dist/components/index.js +7 -0
  68. package/dist/esm/ch-action-group_2.entry.js +206 -0
  69. package/dist/esm/ch-dropdown-item.entry.js +36 -5
  70. package/dist/esm/ch-dropdown.entry.js +50 -52
  71. package/dist/esm/{ch-grid_4.entry.js → ch-grid_8.entry.js} +140 -1
  72. package/dist/esm/{ch-suggest_5.entry.js → ch-suggest_4.entry.js} +1 -65
  73. package/dist/esm/ch-test-action-group.entry.js +75 -0
  74. package/dist/esm/ch-test-dropdown.entry.js +50 -0
  75. package/dist/esm/ch-window_2.entry.js +25 -6
  76. package/dist/esm/format-date-e9ca0786.js +25 -0
  77. package/dist/esm/genexus-ide-ui.js +1 -1
  78. package/dist/esm/gx-ide-team-dev-commit.entry.js +15 -35
  79. package/dist/esm/gx-ide-team-dev-select-recent-comment.entry.js +5 -15
  80. package/dist/esm/gx-ide-team-dev-update-partial-selection.entry.js +98 -0
  81. package/dist/esm/gx-ide-team-dev-update-to-revision.entry.js +49 -0
  82. package/dist/esm/gx-ide-team-dev-update.entry.js +274 -0
  83. package/dist/esm/gx-ide-top-bar.entry.js +33 -0
  84. package/dist/esm/{gxg-combo-box_8.entry.js → gxg-combo-box_6.entry.js} +2 -132
  85. package/dist/esm/gxg-form-checkbox-group_2.entry.js +135 -0
  86. package/dist/esm/{gx-ide-top-bar_2.entry.js → gxg-form-radio-group.entry.js} +2 -32
  87. package/dist/esm/gxg-text.entry.js +68 -0
  88. package/dist/esm/loader.js +1 -1
  89. package/dist/genexus-ide-ui/genexus-ide-ui.esm.js +1 -1
  90. package/dist/genexus-ide-ui/gx-ide-assets/team-dev-commit/langs/team-dev-commit.lang.en.json +1 -1
  91. package/dist/genexus-ide-ui/gx-ide-assets/team-dev-update/langs/team-dev-update.lang.en.json +45 -0
  92. package/dist/genexus-ide-ui/gx-ide-assets/team-dev-update/langs/team-dev-update.lang.ja.json +3 -0
  93. package/dist/genexus-ide-ui/gx-ide-assets/team-dev-update/langs/team-dev-update.lang.zh.json +3 -0
  94. package/dist/genexus-ide-ui/gx-ide-assets/team-dev-update-partial-selection/langs/team-dev-update-partial-selection.lang.en.json +15 -0
  95. package/dist/genexus-ide-ui/gx-ide-assets/team-dev-update-partial-selection/langs/team-dev-update-partial-selection.lang.ja.json +3 -0
  96. package/dist/genexus-ide-ui/gx-ide-assets/team-dev-update-partial-selection/langs/team-dev-update-partial-selection.lang.zh.json +3 -0
  97. package/dist/genexus-ide-ui/gx-ide-assets/team-dev-update-to-revision/langs/team-dev-update-to-revision.lang.en.json +11 -0
  98. package/dist/genexus-ide-ui/gx-ide-assets/team-dev-update-to-revision/langs/team-dev-update-to-revision.lang.ja.json +3 -0
  99. package/dist/genexus-ide-ui/gx-ide-assets/team-dev-update-to-revision/langs/team-dev-update-to-revision.lang.zh.json +3 -0
  100. package/dist/genexus-ide-ui/p-097a3eeb.entry.js +1 -0
  101. package/dist/genexus-ide-ui/p-16bd5578.entry.js +1 -0
  102. package/dist/genexus-ide-ui/p-32b8abf6.entry.js +1 -0
  103. package/dist/genexus-ide-ui/p-3bdcb73b.entry.js +1 -0
  104. package/dist/genexus-ide-ui/p-4bbe1c18.entry.js +1 -0
  105. package/dist/genexus-ide-ui/p-53d36ef7.entry.js +1 -0
  106. package/dist/genexus-ide-ui/p-5884a014.entry.js +1 -0
  107. package/dist/genexus-ide-ui/p-5c64c57f.entry.js +1 -0
  108. package/dist/genexus-ide-ui/p-5ff04ebe.entry.js +1 -0
  109. package/dist/genexus-ide-ui/p-6e80380b.entry.js +1 -0
  110. package/dist/genexus-ide-ui/p-718759e7.entry.js +1 -0
  111. package/dist/genexus-ide-ui/p-72303355.js +1 -0
  112. package/dist/genexus-ide-ui/p-757f8567.entry.js +1 -0
  113. package/dist/genexus-ide-ui/p-9c82381c.entry.js +1 -0
  114. package/dist/genexus-ide-ui/p-a0e85c2a.entry.js +1 -0
  115. package/dist/genexus-ide-ui/p-afe9515e.entry.js +1 -0
  116. package/dist/genexus-ide-ui/p-dbebb1a0.entry.js +1 -0
  117. package/dist/genexus-ide-ui/p-f8561da6.entry.js +1 -0
  118. package/dist/node_modules/@genexus/chameleon-controls-library/dist/collection/components/action-group/action-group.css +48 -0
  119. package/dist/node_modules/@genexus/chameleon-controls-library/dist/collection/components/action-group-item/action-group-item.css +4 -0
  120. package/dist/node_modules/@genexus/chameleon-controls-library/dist/collection/components/dropdown/dropdown.css +32 -88
  121. package/dist/node_modules/@genexus/chameleon-controls-library/dist/collection/components/dropdown-item/dropdown-item.css +9 -22
  122. package/dist/node_modules/@genexus/chameleon-controls-library/dist/collection/components/test/test-action-group/test-action-group.css +52 -0
  123. package/dist/node_modules/@genexus/chameleon-controls-library/dist/collection/components/test/test-dropdown/test-dropdown.css +36 -0
  124. package/dist/node_modules/@genexus/chameleon-controls-library/dist/collection/components/window/ch-window.css +3 -1
  125. package/dist/types/common/format-date.d.ts +1 -0
  126. package/dist/types/common/types.d.ts +1 -0
  127. package/dist/types/components/team-dev-commit/team-dev-commit.d.ts +13 -7
  128. package/dist/types/components/team-dev-select-recent-comment/team-dev-select-recent-comment.d.ts +1 -31
  129. package/dist/types/components/team-dev-update/team-dev-update.d.ts +173 -0
  130. package/dist/types/components/team-dev-update-partial-selection/team-dev-update-partial-selection.d.ts +61 -0
  131. package/dist/types/components/team-dev-update-to-revision/team-dev-update-to-revision.d.ts +41 -0
  132. package/dist/types/components.d.ts +216 -2
  133. package/package.json +3 -3
  134. package/dist/cjs/ch-grid-column-resize_4.cjs.entry.js +0 -150
  135. package/dist/esm/ch-grid-column-resize_4.entry.js +0 -143
  136. package/dist/genexus-ide-ui/p-04f094d1.entry.js +0 -1
  137. package/dist/genexus-ide-ui/p-192f1342.entry.js +0 -1
  138. package/dist/genexus-ide-ui/p-54cef7ae.entry.js +0 -1
  139. package/dist/genexus-ide-ui/p-554ed73a.entry.js +0 -1
  140. package/dist/genexus-ide-ui/p-6d378d61.entry.js +0 -1
  141. package/dist/genexus-ide-ui/p-b26b5d74.entry.js +0 -1
  142. package/dist/genexus-ide-ui/p-c10d5f34.entry.js +0 -1
  143. package/dist/genexus-ide-ui/p-d5c29251.entry.js +0 -1
  144. package/dist/genexus-ide-ui/p-f1a3397d.entry.js +0 -1
@@ -0,0 +1,206 @@
1
+ import { r as registerInstance, c as createEvent, h, H as Host, g as getElement } from './index-0da01575.js';
2
+
3
+ const actionGroupCss = "*,::after,::before{box-sizing:border-box}:host{display:grid;position:relative;width:100%;grid-template:\"more-actions actions\" 1fr/min-content 1fr;overflow:hidden}.more-actions{grid-area:more-actions}.more-actions::part(expandable-button){width:1.375em;height:1.375em}.more-actions::part(expandable-button)::before{content:\"\";width:100%;height:100%;background-color:currentColor;-webkit-mask:url('data:image/svg+xml,<svg viewBox=\"0 0 25 25\" xmlns=\"http://www.w3.org/2000/svg\"><path d=\"M5.26837 10.5625C4.16837 10.5625 3.26837 11.4625 3.26837 12.5625C3.26837 13.6625 4.16837 14.5625 5.26837 14.5625C6.36837 14.5625 7.26837 13.6625 7.26837 12.5625C7.26837 11.4625 6.36837 10.5625 5.26837 10.5625ZM19.2684 10.5625C18.1684 10.5625 17.2684 11.4625 17.2684 12.5625C17.2684 13.6625 18.1684 14.5625 19.2684 14.5625C20.3684 14.5625 21.2684 13.6625 21.2684 12.5625C21.2684 11.4625 20.3684 10.5625 19.2684 10.5625ZM12.2684 10.5625C11.1684 10.5625 10.2684 11.4625 10.2684 12.5625C10.2684 13.6625 11.1684 14.5625 12.2684 14.5625C13.3684 14.5625 14.2684 13.6625 14.2684 12.5625C14.2684 11.4625 13.3684 10.5625 12.2684 10.5625Z\"/></svg>') 50% 50%/1.25em 1.25em no-repeat}.actions{grid-area:actions;display:grid;grid-auto-flow:column;grid-auto-columns:max-content;width:100%;max-width:100%}.actions--responsive{position:absolute;inset:0}.actions--scroll{overflow-x:auto}.actions--multiline{display:flex;flex-wrap:wrap}";
4
+
5
+ const FLOATING_POINT_ERROR = 1;
6
+ const ChActionGroup = class {
7
+ constructor(hostRef) {
8
+ registerInstance(this, hostRef);
9
+ this.displayedItemsCountChange = createEvent(this, "displayedItemsCountChange", 7);
10
+ this.needForRAF = true; // To prevent redundant RAF (request animation frame) calls
11
+ this.totalItems = -1;
12
+ /**
13
+ * The visible actions when `itemsOverflowBehavior === "ResponsiveCollapse"`.
14
+ */
15
+ this.displayedItems = -1;
16
+ /**
17
+ * This attribute lets you specify the label for the more actions button.
18
+ * Important for accessibility.
19
+ */
20
+ this.buttonLabel = "More actions";
21
+ /**
22
+ * This attribute determines how items behave when the content of the ActionGroup overflows horizontal. This property is needed
23
+ * to make the control responsive to changes in the Width of the container of ActionGroup.
24
+ *
25
+ * | Value | Details |
26
+ * | --------------------- | ------------------------------------------------------------------------------------------------ |
27
+ * | `Add Scroll` | The items of the ActionGroup that overflow horizontally are shown by means of a scroll. |
28
+ * | `Multiline` | The ActionGroup items that overflow horizontally are shown in a second line of the control. |
29
+ * | `Responsive Collapse` | The Action Group items, when they start to overflow the control, are placed in the More Actions. |
30
+ */
31
+ this.itemsOverflowBehavior = "ResponsiveCollapse";
32
+ /**
33
+ * Determine which mouse actions on the expandable button display the dropdown
34
+ * section.
35
+ */
36
+ this.expandBehavior = "ClickOrHover";
37
+ /**
38
+ * @todo Check a better convention for this property, for example, "ActionsInlineAlignment"
39
+ * This attribute determines the position of the More Actions button in the Action Group.
40
+ *
41
+ * | Value | Details |
42
+ * | --------| --------------------------------------------------------------------- |
43
+ * | `Start` | The More Actions Button is displayed to the left of the ActionGroup. |
44
+ * | `End` | The More Actions Button is displayed to the right of the ActionGroup. |
45
+ */
46
+ this.moreActionsButtonPosition = "Start";
47
+ /**
48
+ * Specifies the position of the dropdown section that is placed relative to
49
+ * the more actions button.
50
+ */
51
+ this.moreActionsDropdownPosition = "InsideStart_OutsideEnd";
52
+ /**
53
+ * Determine if the dropdowns should be opened when the action is focused.
54
+ */
55
+ this.openOnFocus = false;
56
+ /**
57
+ * Update the visibility of the actions.
58
+ * Only works if itemsOverflowBehavior === "ResponsiveCollapse"
59
+ */
60
+ this.updateDisplayedActions = () => {
61
+ const actionGroupItems = this.slotItems.assignedElements();
62
+ // The column-gap property must be taken into account
63
+ const columnGap = getComputedStyle(this.actionsContainer).columnGap;
64
+ const columnGapValue = columnGap != null && columnGap.endsWith("px")
65
+ ? Number(columnGap.replace("px", ""))
66
+ : 0;
67
+ // Since the last item does not add column-gap, we have to adjust the measurement
68
+ let availableWidth = this.actionsContainer.clientWidth + columnGapValue - FLOATING_POINT_ERROR;
69
+ let displayedItems = 0;
70
+ // Check which items are visible
71
+ actionGroupItems.forEach(action => {
72
+ const actionWidth = action.clientWidth;
73
+ availableWidth -= actionWidth + columnGapValue;
74
+ if (availableWidth >= 0) {
75
+ action.floating = false;
76
+ displayedItems++;
77
+ }
78
+ else {
79
+ action.floating = true;
80
+ }
81
+ });
82
+ this.totalItems = actionGroupItems.length;
83
+ this.displayedItems = displayedItems;
84
+ this.displayedItemsCountChange.emit(displayedItems);
85
+ };
86
+ this.updateDisplayedActionInFrame = () => {
87
+ if (!this.needForRAF) {
88
+ return;
89
+ }
90
+ this.needForRAF = false; // No need to call RAF up until next frame
91
+ requestAnimationFrame(() => {
92
+ this.needForRAF = true; // RAF now consumes the movement instruction so a new one can come
93
+ this.updateDisplayedActions();
94
+ });
95
+ };
96
+ this.updateActionsWatcher = () => {
97
+ if (this.itemsOverflowBehavior !== "ResponsiveCollapse") {
98
+ return;
99
+ }
100
+ // Avoid memory leaks by disconnecting and re-connecting the observer
101
+ this.disconnectActionsObserver();
102
+ this.connectActionsObserver();
103
+ };
104
+ }
105
+ handleOverflowBehaviorChange(newValue) {
106
+ if (newValue !== "ResponsiveCollapse") {
107
+ const actionGroupItems = this.slotItems.assignedElements();
108
+ // Reset floating
109
+ actionGroupItems.forEach(item => {
110
+ item.floating = false;
111
+ });
112
+ }
113
+ this.setResponsiveCollapse();
114
+ }
115
+ connectActionsObserver() {
116
+ this.actionsWatcher = new ResizeObserver(this.updateDisplayedActionInFrame);
117
+ // Observe the actions
118
+ const actionGroupItems = this.slotItems.assignedElements();
119
+ actionGroupItems.forEach(action => {
120
+ this.actionsWatcher.observe(action);
121
+ });
122
+ }
123
+ connectActionsContainerObserver() {
124
+ this.actionsContainerWatcher = new ResizeObserver(this.updateDisplayedActionInFrame);
125
+ this.actionsContainerWatcher.observe(this.el);
126
+ }
127
+ disconnectActionsObserver() {
128
+ if (this.actionsWatcher) {
129
+ this.actionsWatcher.disconnect();
130
+ this.actionsWatcher = null;
131
+ }
132
+ }
133
+ disconnectActionsContainerObserver() {
134
+ if (this.actionsContainerWatcher) {
135
+ this.actionsContainerWatcher.disconnect();
136
+ this.actionsContainerWatcher = null;
137
+ }
138
+ }
139
+ setResponsiveCollapse() {
140
+ this.disconnectActionsObserver();
141
+ this.disconnectActionsContainerObserver();
142
+ if (this.itemsOverflowBehavior !== "ResponsiveCollapse") {
143
+ return;
144
+ }
145
+ this.connectActionsObserver();
146
+ this.connectActionsContainerObserver();
147
+ }
148
+ componentDidLoad() {
149
+ this.setResponsiveCollapse();
150
+ }
151
+ disconnectedCallback() {
152
+ this.disconnectActionsObserver();
153
+ this.disconnectActionsContainerObserver();
154
+ }
155
+ render() {
156
+ // @todo TODO: Improve accessibility and keyboard navigation
157
+ return (h(Host, { role: "menubar", "aria-label": this.accessibleName }, this.itemsOverflowBehavior === "ResponsiveCollapse" &&
158
+ this.totalItems !== this.displayedItems && (h("ch-dropdown", { exportparts: "expandable-button:more-actions-button,separation:more-actions-separation,list:more-actions-list,section:more-actions-section,mask:more-actions-mask", buttonLabel: this.buttonLabel, class: "more-actions", part: "more-actions", expandBehavior: this.expandBehavior, openOnFocus: this.openOnFocus, position: this.moreActionsDropdownPosition }, h("slot", { name: "more-items", slot: "items" }))), h("div", { class: {
159
+ actions: true,
160
+ "actions--scroll": this.itemsOverflowBehavior === "AddScroll",
161
+ "actions--multiline": this.itemsOverflowBehavior === "Multiline",
162
+ "actions--responsive": this.itemsOverflowBehavior === "ResponsiveCollapse"
163
+ }, part: "actions", ref: el => (this.actionsContainer = el) }, h("slot", { name: "items", onSlotchange: this.updateActionsWatcher, ref: el => (this.slotItems = el) }))));
164
+ }
165
+ get el() { return getElement(this); }
166
+ static get watchers() { return {
167
+ "itemsOverflowBehavior": ["handleOverflowBehaviorChange"]
168
+ }; }
169
+ };
170
+ ChActionGroup.style = actionGroupCss;
171
+
172
+ const actionGroupItemCss = "ch-action-group-item[floating]{position:absolute;visibility:hidden}";
173
+
174
+ const ChActionGroupItem = class {
175
+ constructor(hostRef) {
176
+ registerInstance(this, hostRef);
177
+ /**
178
+ * `true` to ignore the floating property value.
179
+ */
180
+ this.avoidFloating = false;
181
+ /**
182
+ * `true` if the control is floating. Useful to implement the
183
+ * `"ResponsiveCollapse"` value for the `itemsOverflowBehavior` property of
184
+ * the ch-action-group control.
185
+ */
186
+ this.floating = false;
187
+ }
188
+ componentWillLoad() {
189
+ if (this.avoidFloating) {
190
+ return;
191
+ }
192
+ const parentAction = this.el.closest("ch-action-group");
193
+ // Hide items at the start to improve CLS
194
+ if (parentAction) {
195
+ this.floating =
196
+ parentAction.itemsOverflowBehavior === "ResponsiveCollapse";
197
+ }
198
+ }
199
+ render() {
200
+ return h("slot", null);
201
+ }
202
+ get el() { return getElement(this); }
203
+ };
204
+ ChActionGroupItem.style = actionGroupItemCss;
205
+
206
+ export { ChActionGroup as ch_action_group, ChActionGroupItem as ch_action_group_item };
@@ -1,17 +1,45 @@
1
1
  import { r as registerInstance, c as createEvent, h, H as Host, g as getElement } from './index-0da01575.js';
2
2
 
3
- const dropdownItemCss = ":where(a,button){all:unset}*,::before,::after{box-sizing:border-box}@media (prefers-color-scheme: light){.action:focus,.action:hover{background-color:#ccc}.action:active{background-color:#e9e9e9}}@media (prefers-color-scheme: dark){.action:focus,.action:hover{background-color:#3e3e40}.action:active{background-color:#575965}}:host{display:flex;width:100%;height:100%}.action{display:flex;align-items:center;column-gap:8px;width:100%;height:100%;cursor:pointer;padding-block:8px;padding-inline:16px;font-size:0.875em;text-align:start;transition-property:background-color, border-color, box-shadow, color, filter, opacity;transition-duration:250ms}.left-img,.right-img{display:block;width:24px;height:24px;min-width:24px}.content{width:100%}";
3
+ const dropdownItemCss = ":where(a,button){all:unset}*,::before,::after{box-sizing:border-box}:host{display:flex;width:100%;height:100%}:host([force-containing-block]){transform:translateX(0);--ch-window-relative-position:true}.action{display:flex;align-items:center;width:100%;height:100%;cursor:pointer;text-align:start}.left-img,.right-img{display:block;width:24px;height:24px;min-width:24px}.content{width:100%}.dummy-wrapper{display:contents}";
4
4
 
5
+ const DROPDOWN_ITEM = "ch-dropdown-item";
5
6
  const ChDropDownItem = class {
6
7
  constructor(hostRef) {
7
8
  registerInstance(this, hostRef);
8
9
  this.actionClick = createEvent(this, "actionClick", 7);
9
10
  this.focusChange = createEvent(this, "focusChange", 7);
11
+ this.hasItems = false;
12
+ /**
13
+ * Determine which actions on the expandable button display the dropdown
14
+ * section.
15
+ * Only works if the control has subitems.
16
+ */
17
+ this.expandBehavior = "ClickOrHover";
18
+ /**
19
+ * `true` to force the control to make its own containing block.
20
+ */
21
+ this.forceContainingBlock = true;
22
+ /**
23
+ * Determine if the dropdown section should be opened when the expandable
24
+ * button of the control is focused.
25
+ * Only works if the control has subitems.
26
+ */
27
+ this.openOnFocus = false;
28
+ /**
29
+ * Specifies the position of the dropdown section that is placed relative to
30
+ * the expandable button.
31
+ */
32
+ this.position = "Center_OutsideEnd";
10
33
  this.dropDownItemContent = () => [
11
- !!this.leftImgSrc && (h("img", { "aria-hidden": "true", class: "left-img", part: "dropdown-item__left-img", alt: "", src: this.leftImgSrc, loading: "lazy" })),
12
- h("span", { class: "content", part: "dropdown-item__content" }, h("slot", null)),
13
- !!this.rightImgSrc && (h("img", { "aria-hidden": "true", class: "right-img", part: "dropdown-item__right-img", alt: "", src: this.rightImgSrc, loading: "lazy" }))
34
+ !!this.leftImgSrc && (h("img", { "aria-hidden": "true", class: "left-img", part: "left-img", alt: "", src: this.leftImgSrc, loading: "lazy" })),
35
+ h("span", { class: "content", part: "content" }, h("slot", null)),
36
+ !!this.rightImgSrc && (h("img", { "aria-hidden": "true", class: "right-img", part: "right-img", alt: "", src: this.rightImgSrc, loading: "lazy" }))
14
37
  ];
38
+ this.checkItems = () => {
39
+ this.hasItems = !!this.element.querySelector(`:scope>${DROPDOWN_ITEM}`);
40
+ };
41
+ this.noItemsRender = () => this.href ? (h("a", { class: "action", part: "action target", href: this.href, onClick: this.handleActionClick, onFocus: this.handleFocus, ref: el => (this.mainElement = el) }, this.dropDownItemContent(), h("slot", { name: "items", onSlotchange: this.checkItems }))) : (h("button", { class: "action", part: "action button", type: "button", onClick: this.handleActionClick, onFocus: this.handleFocus, ref: el => (this.mainElement = el) }, this.dropDownItemContent(), h("slot", { name: "items", onSlotchange: this.checkItems })));
42
+ this.itemsRender = () => (h("ch-dropdown", { class: "action", exportparts: "expandable-button:action,expandable-button:button,expandable-button:expandable-action,separation,list,section,mask,header,footer,window", expandBehavior: this.expandBehavior, nestedDropdown: true, openOnFocus: this.openOnFocus, position: this.position }, h("div", { class: "dummy-wrapper", slot: "action" }, this.dropDownItemContent()), h("slot", { name: "items", slot: "items", onSlotchange: this.checkItems })));
15
43
  this.handleActionClick = () => {
16
44
  this.actionClick.emit(this.element.id);
17
45
  };
@@ -25,8 +53,11 @@ const ChDropDownItem = class {
25
53
  async handleFocusElement() {
26
54
  this.mainElement.focus();
27
55
  }
56
+ componentWillLoad() {
57
+ this.checkItems();
58
+ }
28
59
  render() {
29
- return (h(Host, { role: "listitem" }, this.href ? (h("a", { class: "action", part: "dropdown-item__target", href: this.href, onClick: this.handleActionClick, onFocus: this.handleFocus, ref: el => (this.mainElement = el) }, this.dropDownItemContent())) : (h("button", { class: "action", part: "dropdown-item__button", type: "button", onClick: this.handleActionClick, onFocus: this.handleFocus, ref: el => (this.mainElement = el) }, this.dropDownItemContent()))));
60
+ return (h(Host, { role: "listitem" }, this.hasItems ? this.itemsRender() : this.noItemsRender()));
30
61
  }
31
62
  get element() { return getElement(this); }
32
63
  };
@@ -1,7 +1,14 @@
1
1
  import { r as registerInstance, c as createEvent, h, H as Host, g as getElement } from './index-0da01575.js';
2
2
 
3
- const dropdownCss = ":where(button){all:unset}*,::before,::after{box-sizing:border-box}@media (prefers-color-scheme: light){.section{background-color:#fbfbfb;color:#000}}@media (prefers-color-scheme: dark){.section{background-color:#242426;color:#e9e9e9}}:host{--ch-dropdown-rtl-initial-X:1;--ch-dropdown-translateX:0;--ch-dropdown-translateY:0;display:flex;position:relative;width:100%;height:100%}.expandable-button{display:flex;position:relative;width:100%;height:100%;cursor:pointer;z-index:108}.expandable-button:focus-within{box-shadow:0px 0px 0 1px currentColor;transition:box-shadow 250ms}.dummy-separation{display:flex;position:absolute;z-index:107}.dummy-separation--vertical{width:100%;height:var(--separation-between-button-size)}.dummy-separation--top{inset-block-start:var(--separation-between-button)}.dummy-separation--bottom{inset-block-end:var(--separation-between-button)}.dummy-separation--horizontal{width:var(--separation-between-button-size);height:100%}.dummy-separation--left{inset-inline-start:var(--separation-between-button)}.dummy-separation--right{inset-inline-end:var(--separation-between-button)}.section{position:absolute;border-radius:5px;box-shadow:0 3px 4px #80808024, 0 3px 3px -2px #8080801f, 0 1px 8px #80808030;width:max-content;max-width:350px;z-index:107}.header+.list,.list+.footer{margin-block-start:8px}.list{display:flex;flex-direction:column;gap:4px}.position--top{inset-block-start:var(--separation-between-button);transform:translate(var(--ch-dropdown-translateX), -100%)}.position--right{inset-inline-end:var(--separation-between-button);transform:translate(calc(100% * var(--ch-dropdown-rtl-initial-X)), var(--ch-dropdown-translateY))}.position--bottom{inset-block-end:var(--separation-between-button);transform:translate(var(--ch-dropdown-translateX), 100%)}.position--left{inset-inline-start:var(--separation-between-button);transform:translate(calc(-100% * var(--ch-dropdown-rtl-initial-X)), var(--ch-dropdown-translateY))}.align--left{inset-inline-start:0}.align--center{inset-inline-start:50%;--ch-dropdown-translateX:calc(-50% * var(--ch-dropdown-rtl-initial-X))}.align--right{inset-inline-end:0}.valign--top{inset-block-start:0}.valign--middle{inset-block-start:50%;--ch-dropdown-translateY:calc(-50% * var(--ch-dropdown-rtl-initial-X))}.valign--bottom{inset-block-end:0}";
3
+ const dropdownCss = ":where(button){all:unset}*,::before,::after{box-sizing:border-box}:host{--separation:0px;--separation-x:var(--separation);--separation-y:var(--separation);display:flex;position:relative;width:100%;height:100%}.expandable-button{display:flex;align-items:center;justify-content:center;position:relative;width:100%;height:100%;cursor:pointer;z-index:108}.expandable-button:focus-within{transition:box-shadow 250ms}::slotted([slot=action]){pointer-events:none}.separation{display:flex;position:absolute;z-index:107}.separation--y{width:100%;height:var(--separation-y)}.separation--y-outside-start{inset-block-start:calc(var(--separation-y) * -1)}.separation--y-outside-start+ch-window{--ch-window-offset-y:calc(var(--separation-y) * -1)}.separation--y-outside-end{inset-block-end:calc(var(--separation-y) * -1)}.separation--y-outside-end+ch-window{--ch-window-offset-y:var(--separation-y)}.separation--x{width:var(--separation-x);height:100%}.separation--x-outside-start{inset-inline-start:calc(var(--separation-x) * -1)}.separation--x-outside-start+ch-window{--ch-window-offset-x:calc(var(--separation-x) * -1)}.separation--x-outside-end{inset-inline-end:calc(var(--separation-x) * -1)}.separation--x-outside-end+ch-window{--ch-window-offset-x:var(--separation-x)}.list{display:flex;flex-direction:column}";
4
4
 
5
+ const mapDropdownAlignToChWindowAlign = {
6
+ OutsideStart: "outside-start",
7
+ InsideStart: "inside-start",
8
+ Center: "center",
9
+ InsideEnd: "inside-end",
10
+ OutsideEnd: "outside-end"
11
+ };
5
12
  const EXPANDABLE_BUTTON_ID = "expandable-button";
6
13
  const SECTION_ID = "section";
7
14
  const DROPDOWN_ITEM_TAG_NAME = "ch-dropdown-item";
@@ -46,11 +53,6 @@ const ChDropDown = class {
46
53
  this.showFooter = false;
47
54
  this.expanded = false;
48
55
  this.expandedWithHover = false;
49
- /**
50
- * Specifies the horizontal alignment the dropdown section has when using
51
- * `position === "Top"` or `position === "Bottom"`.
52
- */
53
- this.align = "Center";
54
56
  /**
55
57
  * This attribute lets you specify the label for the expandable button.
56
58
  * Important for accessibility.
@@ -60,7 +62,12 @@ const ChDropDown = class {
60
62
  * Determine which actions on the expandable button display the dropdown
61
63
  * section.
62
64
  */
63
- this.expandBehavior = "Click or Hover";
65
+ this.expandBehavior = "ClickOrHover";
66
+ /**
67
+ * This attribute lets you specify if the control is nested in another
68
+ * dropdown. Useful to manage keyboard interaction.
69
+ */
70
+ this.nestedDropdown = false;
64
71
  /**
65
72
  * Determine if the dropdown section should be opened when the expandable
66
73
  * button of the control is focused.
@@ -70,17 +77,7 @@ const ChDropDown = class {
70
77
  * Specifies the position of the dropdown section that is placed relative to
71
78
  * the expandable button.
72
79
  */
73
- this.position = "Bottom";
74
- /**
75
- * Specifies the separation (in pixels) between the expandable button and the
76
- * dropdown section of the control.
77
- */
78
- this.dropdownSeparation = 12;
79
- /**
80
- * Specifies the vertical alignment the dropdown section has when using
81
- * `position === "Right"` or `position === "Left"`.
82
- */
83
- this.valign = "Middle";
80
+ this.position = "Center_OutsideEnd";
84
81
  this.closeDropdown = () => {
85
82
  this.closeDropdownWithHover();
86
83
  this.expanded = false;
@@ -94,7 +91,7 @@ const ChDropDown = class {
94
91
  }
95
92
  };
96
93
  this.closeDropdownWhenClickingOutside = (event) => {
97
- if (event.composedPath().find(el => el === this.element) === undefined) {
94
+ if (event.composedPath().find(el => el === this.el) === undefined) {
98
95
  this.closeDropdown();
99
96
  }
100
97
  };
@@ -112,15 +109,14 @@ const ChDropDown = class {
112
109
  if (event.code !== TAB_KEY) {
113
110
  return;
114
111
  }
115
- const nextFocusedElement = event.target;
116
- const isChildElement = nextFocusedElement.closest("ch-dropdown") === this.element;
112
+ const isChildElement = event.composedPath().includes(this.el);
117
113
  if (isChildElement) {
118
114
  return;
119
115
  }
120
116
  this.closeDropdown();
121
117
  };
122
118
  this.handleMouseLeave = () => {
123
- const focusedElementIsInsideDropDown = document.activeElement.closest("ch-dropdown") === this.element;
119
+ const focusedElementIsInsideDropDown = document.activeElement.closest("ch-dropdown") === this.el;
124
120
  if (focusedElementIsInsideDropDown) {
125
121
  this.expanded = true;
126
122
  }
@@ -136,11 +132,13 @@ const ChDropDown = class {
136
132
  this.expandedChange.emit(true);
137
133
  }
138
134
  };
139
- this.handleButtonClick = () => {
135
+ this.handleButtonClick = (event) => {
136
+ event.stopPropagation();
140
137
  this.expandedChange.emit(!this.expanded);
141
138
  this.expanded = !this.expanded;
142
139
  };
143
- this.handleButtonFocus = () => {
140
+ this.handleButtonFocus = (event) => {
141
+ event.stopPropagation();
144
142
  if (this.expanded) {
145
143
  return;
146
144
  }
@@ -159,9 +157,11 @@ const ChDropDown = class {
159
157
  capture: true
160
158
  });
161
159
  // Keyboard events
162
- document.body.addEventListener("keydown", this.handleKeyDownEvents, {
163
- capture: true
164
- });
160
+ if (!this.nestedDropdown) {
161
+ document.body.addEventListener("keydown", this.handleKeyDownEvents, {
162
+ capture: true
163
+ });
164
+ }
165
165
  document.body.addEventListener("keyup", this.handleKeyUpEvents, {
166
166
  capture: true
167
167
  });
@@ -172,9 +172,11 @@ const ChDropDown = class {
172
172
  capture: true
173
173
  });
174
174
  // Keyboard events
175
- document.body.removeEventListener("keydown", this.handleKeyDownEvents, {
176
- capture: true
177
- });
175
+ if (!this.nestedDropdown) {
176
+ document.body.removeEventListener("keydown", this.handleKeyDownEvents, {
177
+ capture: true
178
+ });
179
+ }
178
180
  document.body.removeEventListener("keyup", this.handleKeyUpEvents, {
179
181
  capture: true
180
182
  });
@@ -189,7 +191,7 @@ const ChDropDown = class {
189
191
  this.currentFocusedItem = event.target;
190
192
  }
191
193
  focusFirstDropDownItem() {
192
- this.currentFocusedItem = this.element.querySelector(DROPDOWN_ITEM_SELECTOR);
194
+ this.currentFocusedItem = this.el.querySelector(DROPDOWN_ITEM_SELECTOR);
193
195
  if (this.currentFocusedItem) {
194
196
  this.currentFocusedItem.handleFocusElement();
195
197
  }
@@ -218,40 +220,36 @@ const ChDropDown = class {
218
220
  * works if `openOnFocus = "false"`
219
221
  */
220
222
  returnFocusToButton() {
221
- if (!this.openOnFocus) {
223
+ if (!this.openOnFocus && !this.nestedDropdown) {
222
224
  this.expandableButton.focus();
223
225
  }
224
226
  }
225
227
  componentWillLoad() {
226
- this.showHeader = !!this.element.querySelector(':scope > [slot="header"]');
227
- this.showFooter = !!this.element.querySelector(':scope > [slot="footer"]');
228
+ this.showHeader = !!this.el.querySelector(':scope > [slot="header"]');
229
+ this.showFooter = !!this.el.querySelector(':scope > [slot="footer"]');
228
230
  }
229
231
  render() {
230
- const hasVerticalPosition = this.position === "Bottom" || this.position === "Top";
232
+ const aligns = this.position.split("_");
233
+ const alignX = aligns[0];
234
+ const alignY = aligns[1];
235
+ const hasVerticalPosition = alignY === "OutsideStart" || alignY === "OutsideEnd";
236
+ const xAlignMapping = mapDropdownAlignToChWindowAlign[alignX];
237
+ const yAlignMapping = mapDropdownAlignToChWindowAlign[alignY];
231
238
  const isExpanded = this.expanded || this.expandedWithHover;
232
- return (h(Host, { onMouseLeave: this.expandBehavior === "Click or Hover"
239
+ return (h(Host, { onMouseLeave: this.expandBehavior === "ClickOrHover"
233
240
  ? this.handleMouseLeave
234
- : undefined, style: {
235
- "--separation-between-button": `-${this.dropdownSeparation}px`,
236
- "--separation-between-button-size": `${this.dropdownSeparation}px`
237
- } }, h("button", { id: EXPANDABLE_BUTTON_ID, "aria-controls": SECTION_ID, "aria-expanded": this.expanded.toString(), "aria-haspopup": "true", "aria-label": this.buttonLabel, class: "expandable-button", part: "dropdown__expandable-button", type: "button", onClick: this.handleButtonClick, onFocus: this.openOnFocus ? this.handleButtonFocus : undefined, onMouseEnter: this.expandBehavior === "Click or Hover"
241
+ : undefined }, h("button", { id: EXPANDABLE_BUTTON_ID, "aria-controls": SECTION_ID, "aria-expanded": this.expanded.toString(), "aria-haspopup": "true", "aria-label": this.buttonLabel, class: "expandable-button", part: "expandable-button", type: "button", onClick: this.handleButtonClick, onFocus: this.openOnFocus ? this.handleButtonFocus : undefined, onMouseEnter: this.expandBehavior === "ClickOrHover"
238
242
  ? this.handleMouseEnter
239
- : undefined, ref: el => (this.expandableButton = el) }, h("slot", { name: "action" })), this.expandBehavior === "Click or Hover" && this.expandedWithHover && (
243
+ : undefined, ref: el => (this.expandableButton = el) }, h("slot", { name: "action" })), this.expandBehavior === "ClickOrHover" && (
240
244
  // Necessary since the separation between the button and the section
241
245
  // triggers the onMouseLeave event
242
246
  h("div", { "aria-hidden": "true", class: {
243
- "dummy-separation": true,
244
- [`dummy-separation--${this.position.toLowerCase()}`]: true,
245
- "dummy-separation--vertical": hasVerticalPosition,
246
- "dummy-separation--horizontal": !hasVerticalPosition
247
- }, part: "dropdown__separation" })), h("section", { id: SECTION_ID, "aria-labelledby": EXPANDABLE_BUTTON_ID, class: {
248
- section: true,
249
- [`position--${this.position.toLowerCase()}`]: true,
250
- [`align--${this.align.toLowerCase()}`]: hasVerticalPosition,
251
- [`valign--${this.valign.toLowerCase()}`]: !hasVerticalPosition
252
- }, part: "dropdown__section", hidden: !isExpanded }, this.showHeader && (h("header", { class: "header", part: "dropdown__header" }, h("slot", { name: "header" }))), h("div", { role: "list", class: "list", part: "dropdown__list" }, h("slot", { name: "items" })), this.showFooter && (h("footer", { class: "footer", part: "dropdown__footer" }, h("slot", { name: "footer" }))))));
247
+ separation: true,
248
+ [`separation--y separation--y-${yAlignMapping}`]: hasVerticalPosition,
249
+ [`separation--x separation--x-${xAlignMapping}`]: !hasVerticalPosition
250
+ }, part: "separation" })), h("ch-window", { part: "window", exportparts: "window:section,mask,header,footer", container: this.el, closeOnEscape: true, hidden: !isExpanded, modal: false, showFooter: this.showFooter, showHeader: this.showHeader, xAlign: xAlignMapping, yAlign: yAlignMapping }, this.showHeader && h("slot", { name: "header", slot: "header" }), h("div", { role: "list", class: "list", part: "list" }, h("slot", { name: "items" })), this.showFooter && h("slot", { name: "footer", slot: "footer" }))));
253
251
  }
254
- get element() { return getElement(this); }
252
+ get el() { return getElement(this); }
255
253
  static get watchers() { return {
256
254
  "expanded": ["handleExpandedChange"]
257
255
  }; }