@galaxy-io/dls 2.10.1 → 2.10.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/menu/ContextMenu.d.ts +6 -0
- package/dist/menu/Menu.d.ts +7 -0
- package/dist/menu/Menu.js +30 -18
- package/dist/styles.css +1 -1
- package/package.json +1 -1
|
@@ -34,6 +34,12 @@ export interface ContextMenuProps extends AriaAttributes {
|
|
|
34
34
|
* @default MenuVariant.BASE
|
|
35
35
|
*/
|
|
36
36
|
variant?: MenuVariant;
|
|
37
|
+
/**
|
|
38
|
+
* Accepted for parity with `Menu` and has no effect: a context menu opens at the pointer, so
|
|
39
|
+
* there is no trigger box to match. It sizes to its rows.
|
|
40
|
+
* @default false
|
|
41
|
+
*/
|
|
42
|
+
shouldMatchTriggerWidth?: boolean;
|
|
37
43
|
/** Controlled open state. When set, ContextMenu calls `onOpenChange` and lets the caller decide. */
|
|
38
44
|
isOpen?: boolean;
|
|
39
45
|
/**
|
package/dist/menu/Menu.d.ts
CHANGED
|
@@ -56,6 +56,13 @@ export interface MenuProps extends AriaAttributes {
|
|
|
56
56
|
* @default false
|
|
57
57
|
*/
|
|
58
58
|
isSearchable?: boolean;
|
|
59
|
+
/**
|
|
60
|
+
* The panel takes the trigger's width (a menu opened from a full-width row, such as a sidebar
|
|
61
|
+
* account button). The rows fill it. Never narrower than 160px. The root panel only: submenus
|
|
62
|
+
* size to their rows. No effect on `ContextMenu`, which opens at the pointer and has no trigger box.
|
|
63
|
+
* @default false
|
|
64
|
+
*/
|
|
65
|
+
shouldMatchTriggerWidth?: boolean;
|
|
59
66
|
/** Controlled open state. When set, Menu calls `onOpenChange` and lets the caller decide. */
|
|
60
67
|
isOpen?: boolean;
|
|
61
68
|
/**
|
package/dist/menu/Menu.js
CHANGED
|
@@ -163,18 +163,25 @@ var List = /*#__PURE__*/ styled("div")({
|
|
|
163
163
|
class: "gx-Menu-List-letxokg",
|
|
164
164
|
propsAsIs: false
|
|
165
165
|
});
|
|
166
|
+
/** `shouldMatchTriggerWidth`, root list: fills the panel at any width, still never under the minimum. */
|
|
167
|
+
var LIST_MATCH_TRIGGER_WIDTH_CSS = "gx-Menu-LIST_MATCH_TRIGGER_WIDTH_CSS-l1m37gth";
|
|
168
|
+
/**
|
|
169
|
+
* `shouldMatchTriggerWidth`, root panel: a trigger narrower than the list's minimum still gets the
|
|
170
|
+
* whole list (the panel is `border-box` with a hairline left and right).
|
|
171
|
+
*/
|
|
172
|
+
var PANEL_MATCH_TRIGGER_WIDTH_CSS = "gx-Menu-PANEL_MATCH_TRIGGER_WIDTH_CSS-p1ab151u";
|
|
166
173
|
/** With search: the pinned field over the scrolling list, capped to the room on screen. */
|
|
167
174
|
var SearchLayout = /*#__PURE__*/ styled("div")({
|
|
168
175
|
name: "SearchLayout",
|
|
169
|
-
class: "gx-Menu-SearchLayout-
|
|
176
|
+
class: "gx-Menu-SearchLayout-s1nyz30c",
|
|
170
177
|
propsAsIs: false
|
|
171
178
|
});
|
|
172
179
|
/** With search: only the rows scroll. */
|
|
173
|
-
var SEARCH_LIST_CSS = "gx-Menu-SEARCH_LIST_CSS-
|
|
180
|
+
var SEARCH_LIST_CSS = "gx-Menu-SEARCH_LIST_CSS-s1hougl1";
|
|
174
181
|
/** "No results": a row's box, not interactive. */
|
|
175
182
|
var MenuEmpty = /*#__PURE__*/ styled("div")({
|
|
176
183
|
name: "MenuEmpty",
|
|
177
|
-
class: "gx-Menu-MenuEmpty-
|
|
184
|
+
class: "gx-Menu-MenuEmpty-mjsjxm5",
|
|
178
185
|
propsAsIs: false
|
|
179
186
|
});
|
|
180
187
|
/**
|
|
@@ -183,53 +190,53 @@ var MenuEmpty = /*#__PURE__*/ styled("div")({
|
|
|
183
190
|
* where they are.
|
|
184
191
|
*/
|
|
185
192
|
var MENU_ITEM_VARIANT_TO_CSS_MAP = {
|
|
186
|
-
["DEFAULT"]: "gx-Menu-DEFAULT-
|
|
187
|
-
["ERROR"]: "gx-Menu-ERROR-
|
|
193
|
+
["DEFAULT"]: "gx-Menu-DEFAULT-d11wn83l",
|
|
194
|
+
["ERROR"]: "gx-Menu-ERROR-eotc445"
|
|
188
195
|
};
|
|
189
196
|
/** A disabled row. Declared after the mode map. */
|
|
190
|
-
var ITEM_DISABLED_CSS = "gx-Menu-ITEM_DISABLED_CSS-
|
|
197
|
+
var ITEM_DISABLED_CSS = "gx-Menu-ITEM_DISABLED_CSS-imfg9k5";
|
|
191
198
|
/** `leading` / `trailing`: never squeezed, so only the text shrinks. */
|
|
192
199
|
var Slot = /*#__PURE__*/ styled("span")({
|
|
193
200
|
name: "Slot",
|
|
194
|
-
class: "gx-Menu-Slot-
|
|
201
|
+
class: "gx-Menu-Slot-s1aves2k",
|
|
195
202
|
propsAsIs: false
|
|
196
203
|
});
|
|
197
204
|
/** Label and description, stacked; the only part that shrinks. */
|
|
198
205
|
var Content = /*#__PURE__*/ styled("span")({
|
|
199
206
|
name: "Content",
|
|
200
|
-
class: "gx-Menu-Content-
|
|
207
|
+
class: "gx-Menu-Content-c1n04r8w",
|
|
201
208
|
propsAsIs: false
|
|
202
209
|
});
|
|
203
210
|
/** The check marker's box (width per rung). */
|
|
204
211
|
var CheckSlot = /*#__PURE__*/ styled("span")({
|
|
205
212
|
name: "CheckSlot",
|
|
206
|
-
class: "gx-Menu-CheckSlot-
|
|
213
|
+
class: "gx-Menu-CheckSlot-cwavq3l",
|
|
207
214
|
propsAsIs: false
|
|
208
215
|
});
|
|
209
216
|
/** Icons, caps and markers never shrink. */
|
|
210
|
-
var NO_SHRINK_CSS = "gx-Menu-NO_SHRINK_CSS-
|
|
217
|
+
var NO_SHRINK_CSS = "gx-Menu-NO_SHRINK_CSS-n1dkclye";
|
|
211
218
|
/** A section of rows. */
|
|
212
219
|
var GroupRoot = /*#__PURE__*/ styled("div")({
|
|
213
220
|
name: "GroupRoot",
|
|
214
|
-
class: "gx-Menu-GroupRoot-
|
|
221
|
+
class: "gx-Menu-GroupRoot-g1wbdfpl",
|
|
215
222
|
propsAsIs: false
|
|
216
223
|
});
|
|
217
224
|
/** The section heading. */
|
|
218
225
|
var GroupLabel = /*#__PURE__*/ styled("div")({
|
|
219
226
|
name: "GroupLabel",
|
|
220
|
-
class: "gx-Menu-GroupLabel-
|
|
227
|
+
class: "gx-Menu-GroupLabel-g1e1rrjq",
|
|
221
228
|
propsAsIs: false
|
|
222
229
|
});
|
|
223
230
|
/** While a term is set, a section with no row left disappears (a structural role selector). */
|
|
224
|
-
var GROUP_FILTERED_CSS = "gx-Menu-GROUP_FILTERED_CSS-
|
|
231
|
+
var GROUP_FILTERED_CSS = "gx-Menu-GROUP_FILTERED_CSS-g28zrrg";
|
|
225
232
|
/** The separator wrapper (`role="none"`; the `<hr>` inside is the separator). */
|
|
226
233
|
var SeparatorRoot = /*#__PURE__*/ styled("div")({
|
|
227
234
|
name: "SeparatorRoot",
|
|
228
|
-
class: "gx-Menu-SeparatorRoot-
|
|
235
|
+
class: "gx-Menu-SeparatorRoot-s1c0ylq3",
|
|
229
236
|
propsAsIs: false
|
|
230
237
|
});
|
|
231
238
|
/** Space above and below a separator's rule. */
|
|
232
|
-
var SEPARATOR_CSS = "gx-Menu-SEPARATOR_CSS-
|
|
239
|
+
var SEPARATOR_CSS = "gx-Menu-SEPARATOR_CSS-sd934y5";
|
|
233
240
|
var MenuRootContext = createContext(null);
|
|
234
241
|
var MenuContext = createContext(null);
|
|
235
242
|
/** The context for a part; throws outside a menu. */
|
|
@@ -447,7 +454,7 @@ function MenuList({ children, menuAttributes, className }) {
|
|
|
447
454
|
children: /* @__PURE__ */ jsx(List, {
|
|
448
455
|
...menuAttributes,
|
|
449
456
|
ref: setListRef,
|
|
450
|
-
className,
|
|
457
|
+
className: cx(depth === 0 && root.shouldMatchTriggerWidth && LIST_MATCH_TRIGGER_WIDTH_CSS, className),
|
|
451
458
|
onKeyDown: handleKeyDown,
|
|
452
459
|
onFocus: handleFocus,
|
|
453
460
|
onPointerEnter: handlePointerEnter,
|
|
@@ -891,7 +898,7 @@ function MenuSearchBody({ children, listId, triggerId, ariaLabel }) {
|
|
|
891
898
|
* @internal Shared by Menu and ContextMenu; apps use those. The menu engine: a Popover in `MENU`
|
|
892
899
|
* role (or `DIALOG` around a search field) holding the rows, opened by `popoverTrigger`.
|
|
893
900
|
*/
|
|
894
|
-
var MenuRoot = forwardRef(function MenuRoot({ trigger, children, size = "MEDIUM", variant: variantProp, placement = Placement.BOTTOM_START, isSearchable = false, isOpen, defaultIsOpen = false, onOpenChange, isDisabled = false, ariaLabel, popoverTrigger, id, className, style, ...rest }, ref) {
|
|
901
|
+
var MenuRoot = forwardRef(function MenuRoot({ trigger, children, size = "MEDIUM", variant: variantProp, placement = Placement.BOTTOM_START, isSearchable = false, shouldMatchTriggerWidth = false, isOpen, defaultIsOpen = false, onOpenChange, isDisabled = false, ariaLabel, popoverTrigger, id, className, style, ...rest }, ref) {
|
|
895
902
|
const variant = variantProp ?? "BASE";
|
|
896
903
|
const { isOpen: isOpenState, setOpen } = useControlledOpenState({
|
|
897
904
|
isOpen,
|
|
@@ -913,11 +920,14 @@ var MenuRoot = forwardRef(function MenuRoot({ trigger, children, size = "MEDIUM"
|
|
|
913
920
|
const triggerId = typeof triggerProps.id === "string" ? triggerProps.id : generatedTriggerId;
|
|
914
921
|
const closeTree = useCallback(() => setOpen(false), [setOpen]);
|
|
915
922
|
const term = isSearchable ? normalizeSearchTerm(rawTerm) : "";
|
|
923
|
+
const isMatchingTriggerWidth = shouldMatchTriggerWidth && popoverTrigger !== PopoverTrigger.CONTEXT_MENU;
|
|
924
|
+
const panelClassName = isMatchingTriggerWidth ? cx(PANEL_MATCH_TRIGGER_WIDTH_CSS, className) : className;
|
|
916
925
|
const rootValue = useMemo(() => ({
|
|
917
926
|
size,
|
|
918
927
|
variant,
|
|
919
928
|
term,
|
|
920
929
|
isSearchable,
|
|
930
|
+
shouldMatchTriggerWidth: isMatchingTriggerWidth,
|
|
921
931
|
closeTree,
|
|
922
932
|
search: isSearchable ? {
|
|
923
933
|
inputRef,
|
|
@@ -931,6 +941,7 @@ var MenuRoot = forwardRef(function MenuRoot({ trigger, children, size = "MEDIUM"
|
|
|
931
941
|
variant,
|
|
932
942
|
term,
|
|
933
943
|
isSearchable,
|
|
944
|
+
isMatchingTriggerWidth,
|
|
934
945
|
closeTree,
|
|
935
946
|
rawTerm
|
|
936
947
|
]);
|
|
@@ -973,12 +984,13 @@ var MenuRoot = forwardRef(function MenuRoot({ trigger, children, size = "MEDIUM"
|
|
|
973
984
|
role: isSearchable ? PopoverRole.DIALOG : PopoverRole.MENU,
|
|
974
985
|
variant: MENU_VARIANT_TO_POPOVER_VARIANT_MAP[variant],
|
|
975
986
|
placement,
|
|
987
|
+
shouldMatchTriggerWidth: isMatchingTriggerWidth,
|
|
976
988
|
isOpen: isOpenState,
|
|
977
989
|
onOpenChange: setOpen,
|
|
978
990
|
isDisabled,
|
|
979
991
|
...ariaLabel === void 0 ? {} : { ariaLabel },
|
|
980
992
|
...id === void 0 ? {} : { id },
|
|
981
|
-
...
|
|
993
|
+
...panelClassName === void 0 ? {} : { className: panelClassName },
|
|
982
994
|
...style === void 0 ? {} : { style },
|
|
983
995
|
body,
|
|
984
996
|
children: triggerClone
|