@jobber/components 7.11.1 → 7.11.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.
- package/dist/Autocomplete/index.mjs +1 -1
- package/dist/Menu/Menu.d.ts +21 -1
- package/dist/Menu/menuComposableShared.d.ts +1 -4
- package/dist/Menu-cjs.js +63 -50
- package/dist/Menu-es.js +66 -53
- package/dist/Modal/index.mjs +1 -1
- package/dist/docs/AnimatedPresence/AnimatedPresence.md +1 -1
- package/dist/docs/Autocomplete/AutocompleteV1.md +1 -1
- package/dist/docs/Autocomplete/AutocompleteV2.md +1 -1
- package/dist/docs/Banner/Banner.md +41 -41
- package/dist/docs/Box/Box.md +5 -5
- package/dist/docs/Button/Button.md +13 -13
- package/dist/docs/Checkbox/Checkbox.md +2 -2
- package/dist/docs/Chip/Chip.md +2 -2
- package/dist/docs/Cluster/Cluster.md +3 -3
- package/dist/docs/Combobox/Combobox.md +1 -1
- package/dist/docs/ConfirmationModal/ConfirmationModal.md +3 -3
- package/dist/docs/Content/Content.md +2 -2
- package/dist/docs/Countdown/Countdown.md +1 -1
- package/dist/docs/DataList/DataList.md +24 -24
- package/dist/docs/DataTable/DataTable.md +7 -7
- package/dist/docs/Divider/Divider.md +1 -1
- package/dist/docs/Flex/Flex.md +1 -1
- package/dist/docs/Form/Form.md +1 -1
- package/dist/docs/FormField/FormField.md +6 -6
- package/dist/docs/FormatDate/FormatDate.md +1 -1
- package/dist/docs/FormatFile/FormatFile.md +22 -22
- package/dist/docs/FormatRelativeDateTime/FormatRelativeDateTime.md +1 -1
- package/dist/docs/FormatTime/FormatTime.md +1 -1
- package/dist/docs/Gallery/Gallery.md +1 -1
- package/dist/docs/Glimmer/Glimmer.md +7 -7
- package/dist/docs/Grid/Grid.md +2 -2
- package/dist/docs/Heading/Heading.md +2 -2
- package/dist/docs/Icon/Icon.md +1 -1
- package/dist/docs/InlineLabel/InlineLabel.md +1 -1
- package/dist/docs/InputDate/InputDate.md +4 -4
- package/dist/docs/InputEmail/InputEmail.md +3 -3
- package/dist/docs/InputFile/InputFile.md +7 -7
- package/dist/docs/InputNumber/InputNumber.md +5 -5
- package/dist/docs/InputPassword/InputPassword.md +3 -3
- package/dist/docs/InputPhoneNumber/InputPhoneNumber.md +2 -2
- package/dist/docs/InputText/InputText.md +7 -7
- package/dist/docs/InputTime/InputTime.md +2 -2
- package/dist/docs/LightBox/LightBox.md +17 -17
- package/dist/docs/Menu/Menu.md +122 -0
- package/dist/docs/Modal/Modal.md +1 -1
- package/dist/docs/MultiSelect/MultiSelect.md +1 -1
- package/dist/docs/Page/Page.md +9 -9
- package/dist/docs/Popover/Popover.md +11 -11
- package/dist/docs/ProgressBar/ProgressBar.md +1 -1
- package/dist/docs/RadioGroup/RadioGroup.md +1 -1
- package/dist/docs/SegmentedControl/SegmentedControl.md +2 -2
- package/dist/docs/Select/Select.md +4 -4
- package/dist/docs/SideKick/SideKick.md +1 -1
- package/dist/docs/Spinner/Spinner.md +1 -1
- package/dist/docs/Text/Text.md +3 -3
- package/dist/docs/Toast/Toast.md +1 -1
- package/dist/floating-ui.react-es.js +1 -1
- package/dist/styles.css +16 -16
- package/dist/utils/mergeUnsafeProps.d.ts +8 -0
- package/package.json +2 -2
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import React__default, { useState, useRef, useEffect, useCallback, useMemo, forwardRef } from 'react';
|
|
2
|
-
import { u as useFloating, k as useClick,
|
|
2
|
+
import { u as useFloating, k as useClick, j as useListNavigation, c as useDismiss, d as useInteractions, F as FloatingPortal, h as FloatingFocusManager, l as useTransitionStyles } from '../floating-ui.react-es.js';
|
|
3
3
|
import classnames from 'classnames';
|
|
4
4
|
import { tokens } from '@jobber/design';
|
|
5
5
|
import { useCallbackRef, useDebounce, useSafeLayoutEffect, useIsMounted, useOnKeyDown } from '@jobber/hooks';
|
package/dist/Menu/Menu.d.ts
CHANGED
|
@@ -32,6 +32,27 @@ export interface MenuComponent {
|
|
|
32
32
|
ItemPrefix: typeof MenuItemPrefix;
|
|
33
33
|
ItemSuffix: typeof MenuItemSuffix;
|
|
34
34
|
}
|
|
35
|
+
export declare function Menu(props: MenuProps): ReactElement;
|
|
36
|
+
export declare namespace Menu {
|
|
37
|
+
var Group: typeof MenuGroup;
|
|
38
|
+
var GroupLabel: typeof MenuGroupLabel;
|
|
39
|
+
var Section: typeof MenuSection;
|
|
40
|
+
var Header: typeof MenuHeader;
|
|
41
|
+
var HeaderLabel: typeof MenuHeaderLabel;
|
|
42
|
+
var Item: React.ForwardRefExoticComponent<ComposableMenuItemProps & React.RefAttributes<HTMLElement>>;
|
|
43
|
+
var Trigger: React.ForwardRefExoticComponent<ComposableMenuTriggerProps & React.RefAttributes<HTMLDivElement>>;
|
|
44
|
+
var Content: typeof MenuContent;
|
|
45
|
+
var Separator: typeof MenuSeparator;
|
|
46
|
+
var RadioGroup: typeof MenuRadioGroup;
|
|
47
|
+
var RadioItem: React.ForwardRefExoticComponent<ComposableMenuRadioItemProps & React.RefAttributes<HTMLElement>>;
|
|
48
|
+
var Submenu: typeof MenuSubmenu;
|
|
49
|
+
var SubmenuTrigger: React.ForwardRefExoticComponent<ComposableMenuSubmenuTriggerProps & React.RefAttributes<HTMLElement>>;
|
|
50
|
+
var SubmenuContent: typeof MenuSubmenuContent;
|
|
51
|
+
var ItemIcon: typeof MenuItemIcon;
|
|
52
|
+
var ItemLabel: typeof MenuItemLabel;
|
|
53
|
+
var ItemPrefix: typeof MenuItemPrefix;
|
|
54
|
+
var ItemSuffix: typeof MenuItemSuffix;
|
|
55
|
+
}
|
|
35
56
|
declare const MenuTrigger: React.ForwardRefExoticComponent<ComposableMenuTriggerProps & React.RefAttributes<HTMLDivElement>>;
|
|
36
57
|
declare function MenuContent(props: ComposableMenuContentProps): React.JSX.Element;
|
|
37
58
|
declare function MenuSeparator(props: ComposableMenuSeparatorProps): React.JSX.Element;
|
|
@@ -65,5 +86,4 @@ declare function MenuHeader(props: MenuHeaderComposableProps): React.JSX.Element
|
|
|
65
86
|
* Menu.Header > Menu.HeaderLabel continues to compose onto the new GroupLabel.
|
|
66
87
|
*/
|
|
67
88
|
declare function MenuHeaderLabel(props: MenuHeaderLabelComposableProps): React.JSX.Element;
|
|
68
|
-
export declare const Menu: MenuComponent;
|
|
69
89
|
export {};
|
|
@@ -6,10 +6,7 @@ export declare function resolveComposableBaseProps(props: {
|
|
|
6
6
|
readonly style?: React.CSSProperties;
|
|
7
7
|
readonly UNSAFE_className?: string;
|
|
8
8
|
readonly UNSAFE_style?: React.CSSProperties;
|
|
9
|
-
}):
|
|
10
|
-
className: string | undefined;
|
|
11
|
-
style: React.CSSProperties | undefined;
|
|
12
|
-
};
|
|
9
|
+
}): Pick<import("../utils/mergeUnsafeProps").UnsafeProps, "className" | "style">;
|
|
13
10
|
export declare function hasMenuSlot(children: React.ReactNode, slot: MenuSlotName): boolean;
|
|
14
11
|
export declare function resolveMenuTriggerRender({ children, render, }: {
|
|
15
12
|
readonly children?: React.ReactNode;
|
package/dist/Menu-cjs.js
CHANGED
|
@@ -11,8 +11,8 @@ var Icon = require('./Icon-cjs.js');
|
|
|
11
11
|
var useFormFieldFocus = require('./useFormFieldFocus-cjs.js');
|
|
12
12
|
var maxHeight = require('./maxHeight-cjs.js');
|
|
13
13
|
var floatingUi_reactDom = require('./floating-ui.react-dom-cjs.js');
|
|
14
|
-
var tslib_es6 = require('./tslib.es6-cjs.js');
|
|
15
14
|
var useRenderElement = require('./useRenderElement-cjs.js');
|
|
15
|
+
var tslib_es6 = require('./tslib.es6-cjs.js');
|
|
16
16
|
var BottomSheet = require('./BottomSheet-cjs.js');
|
|
17
17
|
var OverlaySeparator = require('./OverlaySeparator-cjs.js');
|
|
18
18
|
var MenuSubmenuTrigger$1 = require('./MenuSubmenuTrigger-cjs.js');
|
|
@@ -200,7 +200,17 @@ function MenuPortal({ children }) {
|
|
|
200
200
|
|
|
201
201
|
var styles$1 = {"submenuHeader":"Vw9MFreevMU-","submenuTitle":"wpNMcBuNwwY-","spinning":"nOEBQCC4Cos-"};
|
|
202
202
|
|
|
203
|
-
var styles = {"wrapper":"fpi0W91w2ag-","floatingContainer":"ba-Kj6mvQUw-","menu":"-DayvgvIcVo-","legacySection":"VsRRunpS6Yo-","separator":"jnggqK3YTIU-","triggerWrapper":"oRQQVVq-yxA-","
|
|
203
|
+
var styles = {"wrapper":"fpi0W91w2ag-","floatingContainer":"ba-Kj6mvQUw-","menu":"-DayvgvIcVo-","legacySection":"VsRRunpS6Yo-","separator":"jnggqK3YTIU-","triggerWrapper":"oRQQVVq-yxA-","composableMenu":"atokGnmWVls-","bottomSheetMenuContent":"J3CW8IU48RM-","composableItem":"zSMkwrZodBk-","composableItemNoLeadingSlot":"qbDWOwkPouM-","composableSection":"_353OIWGazfE-","composableGroup":"Q0ssxff-Qo4-","composableRadioGroup":"_2VyPM45lQBE-","composableSectionHeader":"efA-ozx9w0w-","composableGroupHeader":"BklkzNPbJ5Q-","composableGroupLabel":"_5-p9DbyRav4-","sectionHeader":"Bq7pLWj3jm4-","legacyAction":"P4Sdaq0-lZs-","action":"M1BgN-oCmKw-","destructive":"U9ihZZavz9w-","overlay":"_7we5hh6kYs8-","bottomSheetSubmenuPopup":"nf47GCAYI-c-","menuHidden":"cuw8ct7rX6s-","bottomSheetSubmenuBody":"a6uZEXgX8sg-","fullWidth":"_5OJ7B6mFcwk-","screenReaderOnly":"Bzvkz60bwWE-","spinning":"_0-VzuzHdi8o-"};
|
|
204
|
+
|
|
205
|
+
function mergeUnsafeProps(props) {
|
|
206
|
+
return useRenderElement.mergeProps({
|
|
207
|
+
className: props.UNSAFE_className,
|
|
208
|
+
style: props.UNSAFE_style,
|
|
209
|
+
}, {
|
|
210
|
+
className: props.className,
|
|
211
|
+
style: props.style,
|
|
212
|
+
});
|
|
213
|
+
}
|
|
204
214
|
|
|
205
215
|
function assignRef(ref, instance) {
|
|
206
216
|
if (!ref) {
|
|
@@ -248,14 +258,10 @@ function stripNativeTypeFromButtonRenderTarget(element) {
|
|
|
248
258
|
}
|
|
249
259
|
|
|
250
260
|
// New composable menu pieces prefer standard DOM props, but we still accept the
|
|
251
|
-
// old UNSAFE_* names during the migration window.
|
|
252
|
-
//
|
|
261
|
+
// old UNSAFE_* names during the migration window. Base UI's merge semantics let
|
|
262
|
+
// either API path continue to work while standard props still win on conflicts.
|
|
253
263
|
function resolveComposableBaseProps(props) {
|
|
254
|
-
|
|
255
|
-
return {
|
|
256
|
-
className: (_a = props.className) !== null && _a !== void 0 ? _a : props.UNSAFE_className,
|
|
257
|
-
style: (_b = props.style) !== null && _b !== void 0 ? _b : props.UNSAFE_style,
|
|
258
|
-
};
|
|
264
|
+
return mergeUnsafeProps(props);
|
|
259
265
|
}
|
|
260
266
|
// Detects whether a composed item already includes a specific slot so each
|
|
261
267
|
// shell can adjust layout without needing to understand every child shape.
|
|
@@ -264,6 +270,9 @@ function hasMenuSlot(children, slot) {
|
|
|
264
270
|
if (!React.isValidElement(child)) {
|
|
265
271
|
return false;
|
|
266
272
|
}
|
|
273
|
+
if (typeof child.type === "string" || !("menuSlot" in child.type)) {
|
|
274
|
+
return false;
|
|
275
|
+
}
|
|
267
276
|
return child.type.menuSlot === slot;
|
|
268
277
|
});
|
|
269
278
|
}
|
|
@@ -302,12 +311,18 @@ function useMenuItemContext() {
|
|
|
302
311
|
}
|
|
303
312
|
function SharedMenuItemIcon(props) {
|
|
304
313
|
const { variation } = useMenuItemContext();
|
|
305
|
-
return (
|
|
314
|
+
return (
|
|
315
|
+
// TODO: Remove this wrapper once Icon can accept the data attributes needed
|
|
316
|
+
// for Menu slot styling directly.
|
|
317
|
+
React.createElement("div", { "data-menu-slot": "icon" },
|
|
306
318
|
React.createElement(Icon.Icon, Object.assign({}, props, { color: variation === "destructive" ? "destructive" : props.color }))));
|
|
307
319
|
}
|
|
308
320
|
function SharedMenuItemLabel(props) {
|
|
309
321
|
const { variation } = useMenuItemContext();
|
|
310
|
-
return (
|
|
322
|
+
return (
|
|
323
|
+
// TODO: Remove this wrapper once Typography can accept the data attributes
|
|
324
|
+
// needed for Menu slot styling directly.
|
|
325
|
+
React.createElement("div", { "data-menu-slot": "label" },
|
|
311
326
|
React.createElement(Typography.Typography, { element: "span", size: "base", fontWeight: "semiBold", textColor: variation === "destructive" ? "destructive" : "text" }, props.children)));
|
|
312
327
|
}
|
|
313
328
|
function SharedMenuItemPrefix(props) {
|
|
@@ -480,7 +495,7 @@ function handleBottomSheetMenuContainerKeyDown(event) {
|
|
|
480
495
|
}
|
|
481
496
|
function BottomSheetMenuSurface({ children, className, menuRef, style, }) {
|
|
482
497
|
const { focusModalityRef } = useBottomSheetContext();
|
|
483
|
-
return (React.createElement("div", { ref: menuRef, className: classnames(styles.
|
|
498
|
+
return (React.createElement("div", { ref: menuRef, className: classnames(styles.composableMenu, className), role: "menu", tabIndex: -1, onKeyDown: event => {
|
|
484
499
|
focusModalityRef.current = "keyboard";
|
|
485
500
|
handleBottomSheetMenuContainerKeyDown(event);
|
|
486
501
|
}, style: style }, children));
|
|
@@ -559,7 +574,7 @@ function BottomSheetRadioGroup({ children, value, defaultValue, onValueChange, c
|
|
|
559
574
|
onValueChange === null || onValueChange === void 0 ? void 0 : onValueChange(nextValue);
|
|
560
575
|
},
|
|
561
576
|
} },
|
|
562
|
-
React.createElement("div", { className: classnames(styles.
|
|
577
|
+
React.createElement("div", { className: classnames(styles.composableRadioGroup, resolvedBaseProps.className), style: resolvedBaseProps.style }, children)));
|
|
563
578
|
}
|
|
564
579
|
function BottomSheetGroup(props) {
|
|
565
580
|
const { className, style } = resolveComposableBaseProps(props);
|
|
@@ -577,8 +592,8 @@ const BottomSheetItem = React.forwardRef(function BottomSheetItem(props, ref) {
|
|
|
577
592
|
const { className: itemClassName, style } = resolveComposableBaseProps(props);
|
|
578
593
|
const hasLeadingContent = hasMenuSlot(props.children, "icon") ||
|
|
579
594
|
hasMenuSlot(props.children, "prefix");
|
|
580
|
-
const className = classnames(styles.action, styles.
|
|
581
|
-
[styles.
|
|
595
|
+
const className = classnames(styles.action, styles.composableItem, {
|
|
596
|
+
[styles.composableItemNoLeadingSlot]: !hasLeadingContent,
|
|
582
597
|
}, {
|
|
583
598
|
[styles.destructive]: props.variation === "destructive",
|
|
584
599
|
}, itemClassName);
|
|
@@ -614,8 +629,8 @@ const BottomSheetRadioItem = React.forwardRef(function BottomSheetRadioItem(prop
|
|
|
614
629
|
const hasCustomSuffix = hasMenuSlot(props.children, "suffix");
|
|
615
630
|
const hasLeadingContent = hasMenuSlot(props.children, "icon") ||
|
|
616
631
|
hasMenuSlot(props.children, "prefix");
|
|
617
|
-
return (React.createElement("button", Object.assign({ ref: ref, className: classnames(styles.action, styles.
|
|
618
|
-
[styles.
|
|
632
|
+
return (React.createElement("button", Object.assign({ ref: ref, className: classnames(styles.action, styles.composableItem, {
|
|
633
|
+
[styles.composableItemNoLeadingSlot]: !hasLeadingContent,
|
|
619
634
|
}, className), "data-highlighted": isHighlighted ? "" : undefined, style: style, type: "button", role: "menuitemradio", "aria-checked": checked }, interactionProps, { onClick: () => {
|
|
620
635
|
radioGroup === null || radioGroup === void 0 ? void 0 : radioGroup.setValue(props.value);
|
|
621
636
|
if (props.closeOnClick) {
|
|
@@ -660,8 +675,8 @@ const BottomSheetSubmenuTrigger = React.forwardRef(function BottomSheetSubmenuTr
|
|
|
660
675
|
// header can read it the moment it mounts. Prefer the explicit textValue
|
|
661
676
|
// used for type-to-select, and fall back to the rendered text content.
|
|
662
677
|
titleRef.current = textValue !== null && textValue !== void 0 ? textValue : getTextContent(children).trim();
|
|
663
|
-
return (React.createElement(MenuSubmenuTrigger$1.DrawerTrigger, Object.assign({ ref: ref, role: "menuitem", "aria-haspopup": "menu", "data-highlighted": isHighlighted ? "" : undefined, className: classnames(styles.action, styles.
|
|
664
|
-
[styles.
|
|
678
|
+
return (React.createElement(MenuSubmenuTrigger$1.DrawerTrigger, Object.assign({ ref: ref, role: "menuitem", "aria-haspopup": "menu", "data-highlighted": isHighlighted ? "" : undefined, className: classnames(styles.action, styles.composableItem, {
|
|
679
|
+
[styles.composableItemNoLeadingSlot]: !hasLeadingContent,
|
|
665
680
|
}, resolvedBaseProps.className), style: resolvedBaseProps.style, nativeButton: true }, interactionProps, { render: React.createElement("button", { type: "button" }) }),
|
|
666
681
|
children,
|
|
667
682
|
!hasCustomSuffix ? (React.createElement("div", { "data-menu-slot": "suffix" },
|
|
@@ -686,7 +701,7 @@ function BottomSheetSubmenuContent({ children, className, style, UNSAFE_style, U
|
|
|
686
701
|
React.createElement(MenuSubmenuTrigger$1.DrawerClose, { "aria-label": title ? `Back to ${title}` : "Back", render: React.createElement(Button.Button, { ariaLabel: title ? `Back to ${title}` : "Back", icon: "arrowLeft", type: "tertiary", variation: "subtle" }) }),
|
|
687
702
|
title ? (React.createElement("div", { className: styles$1.submenuTitle },
|
|
688
703
|
React.createElement(Typography.Typography, { element: "span", size: "base", fontWeight: "semiBold", textColor: "text" }, title))) : null),
|
|
689
|
-
React.createElement(BottomSheetMenuSurface, { menuRef: menuRef, className: classnames(styles.bottomSheetSubmenuBody, styles.
|
|
704
|
+
React.createElement(BottomSheetMenuSurface, { menuRef: menuRef, className: classnames(styles.bottomSheetSubmenuBody, styles.composableSection, resolvedBaseProps.className) }, children))));
|
|
690
705
|
}
|
|
691
706
|
function BottomSheetGroupLabel(props) {
|
|
692
707
|
const { className, style } = resolveComposableBaseProps(props);
|
|
@@ -773,7 +788,7 @@ function MenuDropdownContent({ children, style, className, preferredPlacement, U
|
|
|
773
788
|
const popupStyle = getMenuPopupStyle(resolvedBaseProps.style);
|
|
774
789
|
return (React.createElement(MenuSubmenuTrigger$1.MenuPortal, null,
|
|
775
790
|
React.createElement(MenuSubmenuTrigger$1.MenuPositioner, { className: styles.floatingContainer, style: floatingLayerStyle, align: align, side: side, sideOffset: MENU_OFFSET },
|
|
776
|
-
React.createElement(MenuSubmenuTrigger$1.MenuPopup, { className: classnames(styles.menu, styles.
|
|
791
|
+
React.createElement(MenuSubmenuTrigger$1.MenuPopup, { className: classnames(styles.menu, styles.composableMenu, resolvedBaseProps.className), style: popupStyle }, children))));
|
|
777
792
|
}
|
|
778
793
|
function MenuDropdownRadioGroup({ children, value, defaultValue, onValueChange, className, style, UNSAFE_style, UNSAFE_className, }) {
|
|
779
794
|
const resolvedBaseProps = resolveComposableBaseProps({
|
|
@@ -784,7 +799,7 @@ function MenuDropdownRadioGroup({ children, value, defaultValue, onValueChange,
|
|
|
784
799
|
});
|
|
785
800
|
return (React.createElement(MenuSubmenuTrigger$1.MenuRadioGroup, { value: value, defaultValue: defaultValue, onValueChange: nextValue => {
|
|
786
801
|
onValueChange === null || onValueChange === void 0 ? void 0 : onValueChange(String(nextValue));
|
|
787
|
-
}, className: classnames(styles.
|
|
802
|
+
}, className: classnames(styles.composableRadioGroup, resolvedBaseProps.className), style: resolvedBaseProps.style }, children));
|
|
788
803
|
}
|
|
789
804
|
function MenuDropdownSeparator({ style, className, UNSAFE_style, UNSAFE_className, }) {
|
|
790
805
|
const resolvedBaseProps = resolveComposableBaseProps({
|
|
@@ -805,8 +820,8 @@ const MenuDropdownItem = React.forwardRef(function MenuDropdownItem(props, ref)
|
|
|
805
820
|
const { textValue } = props;
|
|
806
821
|
const hasLeadingContent = hasMenuSlot(props.children, "icon") ||
|
|
807
822
|
hasMenuSlot(props.children, "prefix");
|
|
808
|
-
const className = classnames(styles.action, styles.
|
|
809
|
-
[styles.
|
|
823
|
+
const className = classnames(styles.action, styles.composableItem, {
|
|
824
|
+
[styles.composableItemNoLeadingSlot]: !hasLeadingContent,
|
|
810
825
|
[styles.destructive]: props.variation === "destructive",
|
|
811
826
|
}, itemClassName);
|
|
812
827
|
if (props.href) {
|
|
@@ -831,8 +846,8 @@ const MenuDropdownRadioItem = React.forwardRef(function MenuDropdownRadioItem(pr
|
|
|
831
846
|
const hasCustomSuffix = hasMenuSlot(props.children, "suffix");
|
|
832
847
|
const hasLeadingContent = hasMenuSlot(props.children, "icon") ||
|
|
833
848
|
hasMenuSlot(props.children, "prefix");
|
|
834
|
-
return (React.createElement(MenuSubmenuTrigger$1.MenuRadioItem, { ref: ref, className: classnames(styles.action, styles.
|
|
835
|
-
[styles.
|
|
849
|
+
return (React.createElement(MenuSubmenuTrigger$1.MenuRadioItem, { ref: ref, className: classnames(styles.action, styles.composableItem, {
|
|
850
|
+
[styles.composableItemNoLeadingSlot]: !hasLeadingContent,
|
|
836
851
|
}, className), style: style, value: props.value, label: props.textValue, closeOnClick: props.closeOnClick, nativeButton: true, render: React.createElement("button", { type: "button" }) },
|
|
837
852
|
React.createElement(MenuItemProvider, null,
|
|
838
853
|
props.children,
|
|
@@ -849,8 +864,8 @@ const MenuDropdownSubmenuTrigger = React.forwardRef(function MenuDropdownSubmenu
|
|
|
849
864
|
const hasCustomSuffix = hasMenuSlot(props.children, "suffix");
|
|
850
865
|
const hasLeadingContent = hasMenuSlot(props.children, "icon") ||
|
|
851
866
|
hasMenuSlot(props.children, "prefix");
|
|
852
|
-
return (React.createElement(MenuSubmenuTrigger$1.MenuSubmenuTrigger, { ref: ref, className: classnames(styles.action, styles.
|
|
853
|
-
[styles.
|
|
867
|
+
return (React.createElement(MenuSubmenuTrigger$1.MenuSubmenuTrigger, { ref: ref, className: classnames(styles.action, styles.composableItem, {
|
|
868
|
+
[styles.composableItemNoLeadingSlot]: !hasLeadingContent,
|
|
854
869
|
}, resolvedBaseProps.className), style: resolvedBaseProps.style, label: props.textValue, nativeButton: true, render: React.createElement("button", { type: "button" }) },
|
|
855
870
|
props.children,
|
|
856
871
|
!hasCustomSuffix ? (React.createElement("div", { "data-menu-slot": "suffix" },
|
|
@@ -867,7 +882,7 @@ function MenuDropdownSubmenuContent({ children, className, style, UNSAFE_style,
|
|
|
867
882
|
const popupStyle = getMenuPopupStyle(resolvedBaseProps.style);
|
|
868
883
|
return (React.createElement(MenuSubmenuTrigger$1.MenuPortal, null,
|
|
869
884
|
React.createElement(MenuSubmenuTrigger$1.MenuPositioner, { className: styles.floatingContainer, style: floatingLayerStyle, align: "start", side: "right", sideOffset: MENU_OFFSET },
|
|
870
|
-
React.createElement(MenuSubmenuTrigger$1.MenuPopup, { className: classnames(styles.menu, styles.
|
|
885
|
+
React.createElement(MenuSubmenuTrigger$1.MenuPopup, { className: classnames(styles.menu, styles.composableMenu, resolvedBaseProps.className), style: popupStyle }, children))));
|
|
871
886
|
}
|
|
872
887
|
function MenuDropdownGroupLabel(props) {
|
|
873
888
|
const { className, style } = resolveComposableBaseProps(props);
|
|
@@ -914,7 +929,7 @@ function MenuComposableRoot(props) {
|
|
|
914
929
|
return (React.createElement(MenuContext.Provider, { value: { isMobile } },
|
|
915
930
|
React.createElement(RootComponent, { onOpenChange: props.onOpenChange, open: props.open, defaultOpen: props.defaultOpen }, props.children)));
|
|
916
931
|
}
|
|
917
|
-
function
|
|
932
|
+
function Menu(props) {
|
|
918
933
|
if (isLegacy(props)) {
|
|
919
934
|
return React.createElement(MenuLegacy, Object.assign({}, props));
|
|
920
935
|
}
|
|
@@ -1011,25 +1026,23 @@ function MenuHeaderLabel(props) {
|
|
|
1011
1026
|
}
|
|
1012
1027
|
// Menu now routes the legacy items-based API locally and owns the new
|
|
1013
1028
|
// Base UI-backed composable implementation directly.
|
|
1014
|
-
|
|
1015
|
-
|
|
1016
|
-
|
|
1017
|
-
|
|
1018
|
-
|
|
1019
|
-
|
|
1020
|
-
|
|
1021
|
-
|
|
1022
|
-
|
|
1023
|
-
|
|
1024
|
-
|
|
1025
|
-
|
|
1026
|
-
|
|
1027
|
-
|
|
1028
|
-
|
|
1029
|
-
|
|
1030
|
-
|
|
1031
|
-
|
|
1032
|
-
ItemSuffix: MenuItemSuffix,
|
|
1033
|
-
});
|
|
1029
|
+
Menu.Group = MenuGroup;
|
|
1030
|
+
Menu.GroupLabel = MenuGroupLabel;
|
|
1031
|
+
Menu.Section = MenuSection;
|
|
1032
|
+
Menu.Header = MenuHeader;
|
|
1033
|
+
Menu.HeaderLabel = MenuHeaderLabel;
|
|
1034
|
+
Menu.Item = MenuItem;
|
|
1035
|
+
Menu.Trigger = MenuTrigger;
|
|
1036
|
+
Menu.Content = MenuContent;
|
|
1037
|
+
Menu.Separator = MenuSeparator;
|
|
1038
|
+
Menu.RadioGroup = MenuRadioGroup;
|
|
1039
|
+
Menu.RadioItem = MenuRadioItem;
|
|
1040
|
+
Menu.Submenu = MenuSubmenu;
|
|
1041
|
+
Menu.SubmenuTrigger = MenuSubmenuTrigger;
|
|
1042
|
+
Menu.SubmenuContent = MenuSubmenuContent;
|
|
1043
|
+
Menu.ItemIcon = MenuItemIcon;
|
|
1044
|
+
Menu.ItemLabel = MenuItemLabel;
|
|
1045
|
+
Menu.ItemPrefix = MenuItemPrefix;
|
|
1046
|
+
Menu.ItemSuffix = MenuItemSuffix;
|
|
1034
1047
|
|
|
1035
1048
|
exports.Menu = Menu;
|
package/dist/Menu-es.js
CHANGED
|
@@ -2,18 +2,18 @@ import React__default, { useState, useRef, useId, useMemo } from 'react';
|
|
|
2
2
|
import { useWindowDimensions, useRefocusOnActivator } from '@jobber/hooks';
|
|
3
3
|
import classnames from 'classnames';
|
|
4
4
|
import { AnimatePresence, motion } from 'framer-motion';
|
|
5
|
-
import { u as useFloating, c as useDismiss,
|
|
5
|
+
import { u as useFloating, c as useDismiss, j as useListNavigation, d as useInteractions, F as FloatingPortal } from './floating-ui.react-es.js';
|
|
6
6
|
import { B as Button } from './Button-es.js';
|
|
7
7
|
import { T as Typography } from './Typography-es.js';
|
|
8
8
|
import { I as Icon } from './Icon-es.js';
|
|
9
9
|
import { f as formFieldFocusAttribute } from './useFormFieldFocus-es.js';
|
|
10
10
|
import { c as calculateMaxHeight } from './maxHeight-es.js';
|
|
11
11
|
import { o as offset, f as flip, d as size, b as autoUpdate } from './floating-ui.react-dom-es.js';
|
|
12
|
-
import { _ as __rest } from './tslib.es6-es.js';
|
|
13
12
|
import { m as mergeProps } from './useRenderElement-es.js';
|
|
13
|
+
import { _ as __rest } from './tslib.es6-es.js';
|
|
14
14
|
import { B as BottomSheet } from './BottomSheet-es.js';
|
|
15
15
|
import { O as OverlaySeparator } from './OverlaySeparator-es.js';
|
|
16
|
-
import { D as DrawerTrigger, a as DrawerTitle, b as DrawerClose, M as MenuTrigger$1, c as MenuLinkItem, d as MenuItem$1, e as MenuRadioItem$1, f as MenuRadioItemIndicator, g as MenuSubmenuTrigger$1, h as MenuRoot
|
|
16
|
+
import { D as DrawerTrigger, a as DrawerTitle, b as DrawerClose, M as MenuTrigger$1, c as MenuLinkItem, d as MenuItem$1, e as MenuRadioItem$1, f as MenuRadioItemIndicator, g as MenuSubmenuTrigger$1, h as MenuRoot, i as MenuPortal$1, j as MenuPositioner, k as MenuPopup, l as MenuRadioGroup$1, m as MenuGroup$1, n as MenuSubmenuRoot, o as MenuGroupLabel$1 } from './MenuSubmenuTrigger-es.js';
|
|
17
17
|
|
|
18
18
|
var styles$2 = {"wrapper":"h-nk89U2n6Q-","floatingContainer":"krpkWzoaVcc-","menu":"_7sU7mp1w0jM-","legacySection":"_4x-vvEmn4gM-","separator":"i0QNcs4S-wk-","triggerWrapper":"_7CsejipGrzM-","ariaMenu":"bO7lGVQC42c-","ariaItem":"u6fDgbWmPck-","ariaSection":"-TSNrZBKZJI-","ariaSectionHeader":"zs7dS2pKjEw-","sectionHeader":"MZJgunQcmdQ-","legacyAction":"_-1GOlrzd098-","action":"NYXV5w4pd0c-","destructive":"baYK2zQ6-GA-","overlay":"A7T14ALVEKg-","fullWidth":"Lgbn9IRPI5Y-","screenReaderOnly":"o-ps580KdWI-","spinning":"f1oTdSTeUOM-"};
|
|
19
19
|
|
|
@@ -198,7 +198,17 @@ function MenuPortal({ children }) {
|
|
|
198
198
|
|
|
199
199
|
var styles$1 = {"submenuHeader":"Vw9MFreevMU-","submenuTitle":"wpNMcBuNwwY-","spinning":"nOEBQCC4Cos-"};
|
|
200
200
|
|
|
201
|
-
var styles = {"wrapper":"fpi0W91w2ag-","floatingContainer":"ba-Kj6mvQUw-","menu":"-DayvgvIcVo-","legacySection":"VsRRunpS6Yo-","separator":"jnggqK3YTIU-","triggerWrapper":"oRQQVVq-yxA-","
|
|
201
|
+
var styles = {"wrapper":"fpi0W91w2ag-","floatingContainer":"ba-Kj6mvQUw-","menu":"-DayvgvIcVo-","legacySection":"VsRRunpS6Yo-","separator":"jnggqK3YTIU-","triggerWrapper":"oRQQVVq-yxA-","composableMenu":"atokGnmWVls-","bottomSheetMenuContent":"J3CW8IU48RM-","composableItem":"zSMkwrZodBk-","composableItemNoLeadingSlot":"qbDWOwkPouM-","composableSection":"_353OIWGazfE-","composableGroup":"Q0ssxff-Qo4-","composableRadioGroup":"_2VyPM45lQBE-","composableSectionHeader":"efA-ozx9w0w-","composableGroupHeader":"BklkzNPbJ5Q-","composableGroupLabel":"_5-p9DbyRav4-","sectionHeader":"Bq7pLWj3jm4-","legacyAction":"P4Sdaq0-lZs-","action":"M1BgN-oCmKw-","destructive":"U9ihZZavz9w-","overlay":"_7we5hh6kYs8-","bottomSheetSubmenuPopup":"nf47GCAYI-c-","menuHidden":"cuw8ct7rX6s-","bottomSheetSubmenuBody":"a6uZEXgX8sg-","fullWidth":"_5OJ7B6mFcwk-","screenReaderOnly":"Bzvkz60bwWE-","spinning":"_0-VzuzHdi8o-"};
|
|
202
|
+
|
|
203
|
+
function mergeUnsafeProps(props) {
|
|
204
|
+
return mergeProps({
|
|
205
|
+
className: props.UNSAFE_className,
|
|
206
|
+
style: props.UNSAFE_style,
|
|
207
|
+
}, {
|
|
208
|
+
className: props.className,
|
|
209
|
+
style: props.style,
|
|
210
|
+
});
|
|
211
|
+
}
|
|
202
212
|
|
|
203
213
|
function assignRef(ref, instance) {
|
|
204
214
|
if (!ref) {
|
|
@@ -246,14 +256,10 @@ function stripNativeTypeFromButtonRenderTarget(element) {
|
|
|
246
256
|
}
|
|
247
257
|
|
|
248
258
|
// New composable menu pieces prefer standard DOM props, but we still accept the
|
|
249
|
-
// old UNSAFE_* names during the migration window.
|
|
250
|
-
//
|
|
259
|
+
// old UNSAFE_* names during the migration window. Base UI's merge semantics let
|
|
260
|
+
// either API path continue to work while standard props still win on conflicts.
|
|
251
261
|
function resolveComposableBaseProps(props) {
|
|
252
|
-
|
|
253
|
-
return {
|
|
254
|
-
className: (_a = props.className) !== null && _a !== void 0 ? _a : props.UNSAFE_className,
|
|
255
|
-
style: (_b = props.style) !== null && _b !== void 0 ? _b : props.UNSAFE_style,
|
|
256
|
-
};
|
|
262
|
+
return mergeUnsafeProps(props);
|
|
257
263
|
}
|
|
258
264
|
// Detects whether a composed item already includes a specific slot so each
|
|
259
265
|
// shell can adjust layout without needing to understand every child shape.
|
|
@@ -262,6 +268,9 @@ function hasMenuSlot(children, slot) {
|
|
|
262
268
|
if (!React__default.isValidElement(child)) {
|
|
263
269
|
return false;
|
|
264
270
|
}
|
|
271
|
+
if (typeof child.type === "string" || !("menuSlot" in child.type)) {
|
|
272
|
+
return false;
|
|
273
|
+
}
|
|
265
274
|
return child.type.menuSlot === slot;
|
|
266
275
|
});
|
|
267
276
|
}
|
|
@@ -300,12 +309,18 @@ function useMenuItemContext() {
|
|
|
300
309
|
}
|
|
301
310
|
function SharedMenuItemIcon(props) {
|
|
302
311
|
const { variation } = useMenuItemContext();
|
|
303
|
-
return (
|
|
312
|
+
return (
|
|
313
|
+
// TODO: Remove this wrapper once Icon can accept the data attributes needed
|
|
314
|
+
// for Menu slot styling directly.
|
|
315
|
+
React__default.createElement("div", { "data-menu-slot": "icon" },
|
|
304
316
|
React__default.createElement(Icon, Object.assign({}, props, { color: variation === "destructive" ? "destructive" : props.color }))));
|
|
305
317
|
}
|
|
306
318
|
function SharedMenuItemLabel(props) {
|
|
307
319
|
const { variation } = useMenuItemContext();
|
|
308
|
-
return (
|
|
320
|
+
return (
|
|
321
|
+
// TODO: Remove this wrapper once Typography can accept the data attributes
|
|
322
|
+
// needed for Menu slot styling directly.
|
|
323
|
+
React__default.createElement("div", { "data-menu-slot": "label" },
|
|
309
324
|
React__default.createElement(Typography, { element: "span", size: "base", fontWeight: "semiBold", textColor: variation === "destructive" ? "destructive" : "text" }, props.children)));
|
|
310
325
|
}
|
|
311
326
|
function SharedMenuItemPrefix(props) {
|
|
@@ -478,7 +493,7 @@ function handleBottomSheetMenuContainerKeyDown(event) {
|
|
|
478
493
|
}
|
|
479
494
|
function BottomSheetMenuSurface({ children, className, menuRef, style, }) {
|
|
480
495
|
const { focusModalityRef } = useBottomSheetContext();
|
|
481
|
-
return (React__default.createElement("div", { ref: menuRef, className: classnames(styles.
|
|
496
|
+
return (React__default.createElement("div", { ref: menuRef, className: classnames(styles.composableMenu, className), role: "menu", tabIndex: -1, onKeyDown: event => {
|
|
482
497
|
focusModalityRef.current = "keyboard";
|
|
483
498
|
handleBottomSheetMenuContainerKeyDown(event);
|
|
484
499
|
}, style: style }, children));
|
|
@@ -557,7 +572,7 @@ function BottomSheetRadioGroup({ children, value, defaultValue, onValueChange, c
|
|
|
557
572
|
onValueChange === null || onValueChange === void 0 ? void 0 : onValueChange(nextValue);
|
|
558
573
|
},
|
|
559
574
|
} },
|
|
560
|
-
React__default.createElement("div", { className: classnames(styles.
|
|
575
|
+
React__default.createElement("div", { className: classnames(styles.composableRadioGroup, resolvedBaseProps.className), style: resolvedBaseProps.style }, children)));
|
|
561
576
|
}
|
|
562
577
|
function BottomSheetGroup(props) {
|
|
563
578
|
const { className, style } = resolveComposableBaseProps(props);
|
|
@@ -575,8 +590,8 @@ const BottomSheetItem = React__default.forwardRef(function BottomSheetItem(props
|
|
|
575
590
|
const { className: itemClassName, style } = resolveComposableBaseProps(props);
|
|
576
591
|
const hasLeadingContent = hasMenuSlot(props.children, "icon") ||
|
|
577
592
|
hasMenuSlot(props.children, "prefix");
|
|
578
|
-
const className = classnames(styles.action, styles.
|
|
579
|
-
[styles.
|
|
593
|
+
const className = classnames(styles.action, styles.composableItem, {
|
|
594
|
+
[styles.composableItemNoLeadingSlot]: !hasLeadingContent,
|
|
580
595
|
}, {
|
|
581
596
|
[styles.destructive]: props.variation === "destructive",
|
|
582
597
|
}, itemClassName);
|
|
@@ -612,8 +627,8 @@ const BottomSheetRadioItem = React__default.forwardRef(function BottomSheetRadio
|
|
|
612
627
|
const hasCustomSuffix = hasMenuSlot(props.children, "suffix");
|
|
613
628
|
const hasLeadingContent = hasMenuSlot(props.children, "icon") ||
|
|
614
629
|
hasMenuSlot(props.children, "prefix");
|
|
615
|
-
return (React__default.createElement("button", Object.assign({ ref: ref, className: classnames(styles.action, styles.
|
|
616
|
-
[styles.
|
|
630
|
+
return (React__default.createElement("button", Object.assign({ ref: ref, className: classnames(styles.action, styles.composableItem, {
|
|
631
|
+
[styles.composableItemNoLeadingSlot]: !hasLeadingContent,
|
|
617
632
|
}, className), "data-highlighted": isHighlighted ? "" : undefined, style: style, type: "button", role: "menuitemradio", "aria-checked": checked }, interactionProps, { onClick: () => {
|
|
618
633
|
radioGroup === null || radioGroup === void 0 ? void 0 : radioGroup.setValue(props.value);
|
|
619
634
|
if (props.closeOnClick) {
|
|
@@ -658,8 +673,8 @@ const BottomSheetSubmenuTrigger = React__default.forwardRef(function BottomSheet
|
|
|
658
673
|
// header can read it the moment it mounts. Prefer the explicit textValue
|
|
659
674
|
// used for type-to-select, and fall back to the rendered text content.
|
|
660
675
|
titleRef.current = textValue !== null && textValue !== void 0 ? textValue : getTextContent(children).trim();
|
|
661
|
-
return (React__default.createElement(DrawerTrigger, Object.assign({ ref: ref, role: "menuitem", "aria-haspopup": "menu", "data-highlighted": isHighlighted ? "" : undefined, className: classnames(styles.action, styles.
|
|
662
|
-
[styles.
|
|
676
|
+
return (React__default.createElement(DrawerTrigger, Object.assign({ ref: ref, role: "menuitem", "aria-haspopup": "menu", "data-highlighted": isHighlighted ? "" : undefined, className: classnames(styles.action, styles.composableItem, {
|
|
677
|
+
[styles.composableItemNoLeadingSlot]: !hasLeadingContent,
|
|
663
678
|
}, resolvedBaseProps.className), style: resolvedBaseProps.style, nativeButton: true }, interactionProps, { render: React__default.createElement("button", { type: "button" }) }),
|
|
664
679
|
children,
|
|
665
680
|
!hasCustomSuffix ? (React__default.createElement("div", { "data-menu-slot": "suffix" },
|
|
@@ -684,7 +699,7 @@ function BottomSheetSubmenuContent({ children, className, style, UNSAFE_style, U
|
|
|
684
699
|
React__default.createElement(DrawerClose, { "aria-label": title ? `Back to ${title}` : "Back", render: React__default.createElement(Button, { ariaLabel: title ? `Back to ${title}` : "Back", icon: "arrowLeft", type: "tertiary", variation: "subtle" }) }),
|
|
685
700
|
title ? (React__default.createElement("div", { className: styles$1.submenuTitle },
|
|
686
701
|
React__default.createElement(Typography, { element: "span", size: "base", fontWeight: "semiBold", textColor: "text" }, title))) : null),
|
|
687
|
-
React__default.createElement(BottomSheetMenuSurface, { menuRef: menuRef, className: classnames(styles.bottomSheetSubmenuBody, styles.
|
|
702
|
+
React__default.createElement(BottomSheetMenuSurface, { menuRef: menuRef, className: classnames(styles.bottomSheetSubmenuBody, styles.composableSection, resolvedBaseProps.className) }, children))));
|
|
688
703
|
}
|
|
689
704
|
function BottomSheetGroupLabel(props) {
|
|
690
705
|
const { className, style } = resolveComposableBaseProps(props);
|
|
@@ -743,7 +758,7 @@ function MenuDropdownRoot({ children, onOpenChange, open, defaultOpen, }) {
|
|
|
743
758
|
(_a = actionsRef.current) === null || _a === void 0 ? void 0 : _a.close();
|
|
744
759
|
},
|
|
745
760
|
} },
|
|
746
|
-
React__default.createElement(MenuRoot
|
|
761
|
+
React__default.createElement(MenuRoot, { actionsRef: actionsRef, open: open, defaultOpen: defaultOpen, onOpenChange: isOpen => {
|
|
747
762
|
onOpenChange === null || onOpenChange === void 0 ? void 0 : onOpenChange(isOpen);
|
|
748
763
|
} }, children)));
|
|
749
764
|
}
|
|
@@ -771,7 +786,7 @@ function MenuDropdownContent({ children, style, className, preferredPlacement, U
|
|
|
771
786
|
const popupStyle = getMenuPopupStyle(resolvedBaseProps.style);
|
|
772
787
|
return (React__default.createElement(MenuPortal$1, null,
|
|
773
788
|
React__default.createElement(MenuPositioner, { className: styles.floatingContainer, style: floatingLayerStyle, align: align, side: side, sideOffset: MENU_OFFSET },
|
|
774
|
-
React__default.createElement(MenuPopup, { className: classnames(styles.menu, styles.
|
|
789
|
+
React__default.createElement(MenuPopup, { className: classnames(styles.menu, styles.composableMenu, resolvedBaseProps.className), style: popupStyle }, children))));
|
|
775
790
|
}
|
|
776
791
|
function MenuDropdownRadioGroup({ children, value, defaultValue, onValueChange, className, style, UNSAFE_style, UNSAFE_className, }) {
|
|
777
792
|
const resolvedBaseProps = resolveComposableBaseProps({
|
|
@@ -782,7 +797,7 @@ function MenuDropdownRadioGroup({ children, value, defaultValue, onValueChange,
|
|
|
782
797
|
});
|
|
783
798
|
return (React__default.createElement(MenuRadioGroup$1, { value: value, defaultValue: defaultValue, onValueChange: nextValue => {
|
|
784
799
|
onValueChange === null || onValueChange === void 0 ? void 0 : onValueChange(String(nextValue));
|
|
785
|
-
}, className: classnames(styles.
|
|
800
|
+
}, className: classnames(styles.composableRadioGroup, resolvedBaseProps.className), style: resolvedBaseProps.style }, children));
|
|
786
801
|
}
|
|
787
802
|
function MenuDropdownSeparator({ style, className, UNSAFE_style, UNSAFE_className, }) {
|
|
788
803
|
const resolvedBaseProps = resolveComposableBaseProps({
|
|
@@ -803,8 +818,8 @@ const MenuDropdownItem = React__default.forwardRef(function MenuDropdownItem(pro
|
|
|
803
818
|
const { textValue } = props;
|
|
804
819
|
const hasLeadingContent = hasMenuSlot(props.children, "icon") ||
|
|
805
820
|
hasMenuSlot(props.children, "prefix");
|
|
806
|
-
const className = classnames(styles.action, styles.
|
|
807
|
-
[styles.
|
|
821
|
+
const className = classnames(styles.action, styles.composableItem, {
|
|
822
|
+
[styles.composableItemNoLeadingSlot]: !hasLeadingContent,
|
|
808
823
|
[styles.destructive]: props.variation === "destructive",
|
|
809
824
|
}, itemClassName);
|
|
810
825
|
if (props.href) {
|
|
@@ -829,8 +844,8 @@ const MenuDropdownRadioItem = React__default.forwardRef(function MenuDropdownRad
|
|
|
829
844
|
const hasCustomSuffix = hasMenuSlot(props.children, "suffix");
|
|
830
845
|
const hasLeadingContent = hasMenuSlot(props.children, "icon") ||
|
|
831
846
|
hasMenuSlot(props.children, "prefix");
|
|
832
|
-
return (React__default.createElement(MenuRadioItem$1, { ref: ref, className: classnames(styles.action, styles.
|
|
833
|
-
[styles.
|
|
847
|
+
return (React__default.createElement(MenuRadioItem$1, { ref: ref, className: classnames(styles.action, styles.composableItem, {
|
|
848
|
+
[styles.composableItemNoLeadingSlot]: !hasLeadingContent,
|
|
834
849
|
}, className), style: style, value: props.value, label: props.textValue, closeOnClick: props.closeOnClick, nativeButton: true, render: React__default.createElement("button", { type: "button" }) },
|
|
835
850
|
React__default.createElement(MenuItemProvider, null,
|
|
836
851
|
props.children,
|
|
@@ -847,8 +862,8 @@ const MenuDropdownSubmenuTrigger = React__default.forwardRef(function MenuDropdo
|
|
|
847
862
|
const hasCustomSuffix = hasMenuSlot(props.children, "suffix");
|
|
848
863
|
const hasLeadingContent = hasMenuSlot(props.children, "icon") ||
|
|
849
864
|
hasMenuSlot(props.children, "prefix");
|
|
850
|
-
return (React__default.createElement(MenuSubmenuTrigger$1, { ref: ref, className: classnames(styles.action, styles.
|
|
851
|
-
[styles.
|
|
865
|
+
return (React__default.createElement(MenuSubmenuTrigger$1, { ref: ref, className: classnames(styles.action, styles.composableItem, {
|
|
866
|
+
[styles.composableItemNoLeadingSlot]: !hasLeadingContent,
|
|
852
867
|
}, resolvedBaseProps.className), style: resolvedBaseProps.style, label: props.textValue, nativeButton: true, render: React__default.createElement("button", { type: "button" }) },
|
|
853
868
|
props.children,
|
|
854
869
|
!hasCustomSuffix ? (React__default.createElement("div", { "data-menu-slot": "suffix" },
|
|
@@ -865,7 +880,7 @@ function MenuDropdownSubmenuContent({ children, className, style, UNSAFE_style,
|
|
|
865
880
|
const popupStyle = getMenuPopupStyle(resolvedBaseProps.style);
|
|
866
881
|
return (React__default.createElement(MenuPortal$1, null,
|
|
867
882
|
React__default.createElement(MenuPositioner, { className: styles.floatingContainer, style: floatingLayerStyle, align: "start", side: "right", sideOffset: MENU_OFFSET },
|
|
868
|
-
React__default.createElement(MenuPopup, { className: classnames(styles.menu, styles.
|
|
883
|
+
React__default.createElement(MenuPopup, { className: classnames(styles.menu, styles.composableMenu, resolvedBaseProps.className), style: popupStyle }, children))));
|
|
869
884
|
}
|
|
870
885
|
function MenuDropdownGroupLabel(props) {
|
|
871
886
|
const { className, style } = resolveComposableBaseProps(props);
|
|
@@ -912,7 +927,7 @@ function MenuComposableRoot(props) {
|
|
|
912
927
|
return (React__default.createElement(MenuContext.Provider, { value: { isMobile } },
|
|
913
928
|
React__default.createElement(RootComponent, { onOpenChange: props.onOpenChange, open: props.open, defaultOpen: props.defaultOpen }, props.children)));
|
|
914
929
|
}
|
|
915
|
-
function
|
|
930
|
+
function Menu(props) {
|
|
916
931
|
if (isLegacy(props)) {
|
|
917
932
|
return React__default.createElement(MenuLegacy, Object.assign({}, props));
|
|
918
933
|
}
|
|
@@ -1009,25 +1024,23 @@ function MenuHeaderLabel(props) {
|
|
|
1009
1024
|
}
|
|
1010
1025
|
// Menu now routes the legacy items-based API locally and owns the new
|
|
1011
1026
|
// Base UI-backed composable implementation directly.
|
|
1012
|
-
|
|
1013
|
-
|
|
1014
|
-
|
|
1015
|
-
|
|
1016
|
-
|
|
1017
|
-
|
|
1018
|
-
|
|
1019
|
-
|
|
1020
|
-
|
|
1021
|
-
|
|
1022
|
-
|
|
1023
|
-
|
|
1024
|
-
|
|
1025
|
-
|
|
1026
|
-
|
|
1027
|
-
|
|
1028
|
-
|
|
1029
|
-
|
|
1030
|
-
ItemSuffix: MenuItemSuffix,
|
|
1031
|
-
});
|
|
1027
|
+
Menu.Group = MenuGroup;
|
|
1028
|
+
Menu.GroupLabel = MenuGroupLabel;
|
|
1029
|
+
Menu.Section = MenuSection;
|
|
1030
|
+
Menu.Header = MenuHeader;
|
|
1031
|
+
Menu.HeaderLabel = MenuHeaderLabel;
|
|
1032
|
+
Menu.Item = MenuItem;
|
|
1033
|
+
Menu.Trigger = MenuTrigger;
|
|
1034
|
+
Menu.Content = MenuContent;
|
|
1035
|
+
Menu.Separator = MenuSeparator;
|
|
1036
|
+
Menu.RadioGroup = MenuRadioGroup;
|
|
1037
|
+
Menu.RadioItem = MenuRadioItem;
|
|
1038
|
+
Menu.Submenu = MenuSubmenu;
|
|
1039
|
+
Menu.SubmenuTrigger = MenuSubmenuTrigger;
|
|
1040
|
+
Menu.SubmenuContent = MenuSubmenuContent;
|
|
1041
|
+
Menu.ItemIcon = MenuItemIcon;
|
|
1042
|
+
Menu.ItemLabel = MenuItemLabel;
|
|
1043
|
+
Menu.ItemPrefix = MenuItemPrefix;
|
|
1044
|
+
Menu.ItemSuffix = MenuItemSuffix;
|
|
1032
1045
|
|
|
1033
1046
|
export { Menu as M };
|
package/dist/Modal/index.mjs
CHANGED
|
@@ -7,7 +7,7 @@ import { H as Heading } from '../Heading-es.js';
|
|
|
7
7
|
import { B as Button } from '../Button-es.js';
|
|
8
8
|
import { B as ButtonDismiss } from '../ButtonDismiss-es.js';
|
|
9
9
|
import { n as noop } from '../noop-es.js';
|
|
10
|
-
import { b as useFloatingNodeId, u as useFloating, c as useDismiss,
|
|
10
|
+
import { b as useFloatingNodeId, u as useFloating, c as useDismiss, g as useRole, d as useInteractions, a as useFloatingParentNodeId, e as FloatingTree, f as FloatingNode, F as FloatingPortal, h as FloatingFocusManager, i as FloatingOverlay } from '../floating-ui.react-es.js';
|
|
11
11
|
import { b as identity } from '../identity-es.js';
|
|
12
12
|
import { A as AtlantisPortalContent } from '../AtlantisPortalContent-es.js';
|
|
13
13
|
import '../Typography-es.js';
|
|
@@ -71,4 +71,4 @@ example.
|
|
|
71
71
|
| Prop | Type | Required | Default | Description |
|
|
72
72
|
|------|------|----------|---------|-------------|
|
|
73
73
|
| `initial` | `boolean` | No | — | Whether or not to animate the children on mount. By default it's set to false. |
|
|
74
|
-
| `transition` | `"
|
|
74
|
+
| `transition` | `"fade" | "fromBottom" | "fromLeft" | "fromLeftToRight" | "fromRight" | "fromRightToLeft" | "fromTop" | "popIn"` | No | — | The type of transition you can use. |
|
|
@@ -1323,7 +1323,7 @@ is, focus the extra element and if not it will focus the input.
|
|
|
1323
1323
|
| `onFocus` | `(event?: FocusEvent<Element, Element>) => void` | No | — | Focus callback. |
|
|
1324
1324
|
| `prefix` | `Affix` | No | — | Adds a prefix label and icon to the field |
|
|
1325
1325
|
| `ref` | `Ref<InputTextRef>` | No | — | Allows getting a ref to the component instance. Once the component unmounts, React will set `ref.current` to `null` (... |
|
|
1326
|
-
| `size` | `"
|
|
1326
|
+
| `size` | `"large" | "small"` | No | — | Adjusts the interface to either have small or large spacing. |
|
|
1327
1327
|
| `suffix` | `{ onClick: () => void; readonly ariaLabel: string; readonly icon: IconNames; readonly label?: string; } | { onClick?: never; ariaLabel?: never; readonly label?: string; readonly icon?: IconNames; }` | No | — | Adds a suffix label and icon with an optional action to the field |
|
|
1328
1328
|
| `validations` | `RegisterOptions` | No | — | Validations to run on the input. |
|
|
1329
1329
|
| `version` | `1` | No | `1` | Version of the component to use. |
|
|
@@ -811,7 +811,7 @@ This is not yet implemented fully. Avoid using.
|
|
|
811
811
|
| `prefix` | `Affix` | No | — | Adds a prefix label and icon to the field. |
|
|
812
812
|
| `readOnly` | `boolean` | No | — | Whether the input is read-only (HTML standard casing). |
|
|
813
813
|
| `ref` | `Ref<HTMLInputElement | HTMLTextAreaElement>` | No | — | |
|
|
814
|
-
| `size` | `"
|
|
814
|
+
| `size` | `"large" | "small"` | No | — | Adjusts the interface to either have small or large spacing. |
|
|
815
815
|
| `suffix` | `{ onClick: () => void; readonly ariaLabel: string; readonly icon: IconNames; readonly label?: string; } | { onClick?: never; ariaLabel?: never; readonly label?: string; readonly icon?: IconNames; }` | No | — | Adds a suffix label and icon with an optional action to the field. |
|
|
816
816
|
| `UNSAFE_className` | `{ menu?: string; option?: string; section?: string; action?: string; input?: string; header?: string; footer?: string; selection?: string; }` | No | — | **Use at your own risk:** Custom class names for specific elements. This should only be used as a **last resort**. Us... |
|
|
817
817
|
| `UNSAFE_styles` | `{ menu?: CSSProperties; option?: CSSProperties; section?: CSSProperties; action?: CSSProperties; input?: CSSProperties; header?: CSSProperties; footer?: CSSProperties; selection?: CSSProperties; }` | No | — | **Use at your own risk:** Custom style for specific elements. This should only be used as a **last resort**. Using th... |
|