@jobber/components 6.98.2 → 6.99.0

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.
@@ -1,78 +1,29 @@
1
- import type { CSSProperties, ReactElement } from "react";
1
+ import type { ReactElement } from "react";
2
2
  import React from "react";
3
- import type { IconColorNames, IconNames } from "@jobber/design";
4
- export interface MenuProps {
5
- /**
6
- * Custom menu activator. If this is not provided a default [… More] will be used.
7
- */
8
- readonly activator?: ReactElement;
9
- /**
10
- * Collection of action items.
11
- */
12
- readonly items: SectionProps[];
13
- /**
14
- * **Use at your own risk:** Custom class names for specific elements. This should only be used as a
15
- * **last resort**. Using this may result in unexpected side effects.
16
- * More information in the [Customizing components Guide](https://atlantis.getjobber.com/guides/customizing-components).
17
- */
18
- readonly UNSAFE_className?: {
19
- menu?: string;
20
- header?: string;
21
- action?: string;
22
- };
23
- /**
24
- * **Use at your own risk:** Custom style for specific elements. This should only be used as a
25
- * **last resort**. Using this may result in unexpected side effects.
26
- * More information in the [Customizing components Guide](https://atlantis.getjobber.com/guides/customizing-components).
27
- */
28
- readonly UNSAFE_style?: {
29
- menu?: CSSProperties;
30
- header?: CSSProperties;
31
- action?: CSSProperties;
32
- };
33
- }
34
- export interface SectionProps {
35
- /**
36
- * Defines the section header to further explain the group of actions.
37
- */
38
- header?: string;
39
- /**
40
- * List of actions.
41
- */
42
- actions: ActionProps[];
43
- }
44
- export declare function Menu({ activator, items, UNSAFE_className, UNSAFE_style, }: MenuProps): React.JSX.Element;
45
- export interface ActionProps {
46
- /**
47
- * Action label
48
- */
49
- readonly label: string;
50
- /**
51
- * Parent Section Label
52
- */
53
- readonly sectionLabel?: string;
54
- /**
55
- * Visual cue for the action label
56
- */
57
- readonly icon?: IconNames;
58
- /**
59
- * Color for the icon. Defaults to "icon".
60
- */
61
- readonly iconColor?: IconColorNames;
62
- /**
63
- * Visual style for the action button
64
- */
65
- readonly destructive?: boolean;
66
- /**
67
- * Inline style overrides for the action button
68
- */
69
- readonly UNSAFE_style?: CSSProperties;
70
- /**
71
- * Style class overrides for the action button
72
- */
73
- readonly UNSAFE_className?: string;
74
- /**
75
- * Callback when an action gets clicked
76
- */
77
- onClick?(event: React.MouseEvent<HTMLButtonElement>): void;
3
+ import type { MenuComposableProps, MenuContentComposableProps, MenuHeaderComposableProps, MenuItemComposableProps, MenuItemIconComposableProps, MenuLegacyProps, MenuSectionComposableProps, MenuSeparatorComposableProps, MenuTriggerComposableProps } from "./Menu.types";
4
+ export declare function Menu(props: MenuLegacyProps): ReactElement;
5
+ export declare function Menu(props: MenuComposableProps): ReactElement;
6
+ export declare namespace Menu {
7
+ var Section: typeof MenuSectionComposable;
8
+ var Header: typeof MenuHeaderComposable;
9
+ var Item: React.ForwardRefExoticComponent<MenuItemComposableProps & React.RefAttributes<object>>;
10
+ var Trigger: React.ForwardRefExoticComponent<MenuTriggerComposableProps & React.RefAttributes<HTMLDivElement>>;
11
+ var Content: typeof MenuContentComposable;
12
+ var Separator: typeof MenuSeparatorComposable;
13
+ var ItemIcon: typeof MenuItemIconComposable;
14
+ var ItemLabel: typeof MenuItemLabelComposable;
15
+ var HeaderLabel: typeof MenuHeaderLabel;
78
16
  }
17
+ export declare function MenuLegacy({ activator, items, UNSAFE_className, UNSAFE_style, }: MenuLegacyProps): React.JSX.Element;
18
+ declare function MenuContentComposable({ children, UNSAFE_style, UNSAFE_className, }: MenuContentComposableProps): React.JSX.Element;
19
+ declare function MenuSeparatorComposable({ UNSAFE_style, UNSAFE_className, }: MenuSeparatorComposableProps): React.JSX.Element;
20
+ declare function MenuSectionComposable({ children, UNSAFE_style, UNSAFE_className, ariaLabel, }: MenuSectionComposableProps): React.JSX.Element;
21
+ declare function MenuHeaderComposable(props: MenuHeaderComposableProps): React.JSX.Element;
22
+ declare function MenuItemIconComposable(props: MenuItemIconComposableProps): React.JSX.Element;
23
+ declare function MenuItemLabelComposable(props: {
24
+ readonly children: string;
25
+ }): React.JSX.Element;
26
+ declare function MenuHeaderLabel(props: {
27
+ readonly children: React.ReactNode;
28
+ }): React.JSX.Element;
29
+ export {};
@@ -0,0 +1,183 @@
1
+ import type { IconColorNames, IconNames } from "@jobber/design";
2
+ import type React from "react";
3
+ import type { CSSProperties, ReactElement, ReactNode } from "react";
4
+ import type { IconProps } from "../Icon";
5
+ export interface MenuLegacyProps extends MenuBaseProps {
6
+ /**
7
+ * Custom menu activator. If this is not provided a default [… More] will be used.
8
+ */
9
+ readonly activator?: ReactElement;
10
+ /**
11
+ * Collection of action items.
12
+ */
13
+ readonly items: SectionProps[];
14
+ }
15
+ interface MenuBaseProps {
16
+ /**
17
+ * **Use at your own risk:** Custom class names for specific elements. This should only be used as a
18
+ * **last resort**. Using this may result in unexpected side effects.
19
+ * More information in the [Customizing components Guide](https://atlantis.getjobber.com/guides/customizing-components).
20
+ */
21
+ readonly UNSAFE_className?: {
22
+ menu?: string;
23
+ header?: string;
24
+ action?: string;
25
+ };
26
+ /**
27
+ * **Use at your own risk:** Custom style for specific elements. This should only be used as a
28
+ * **last resort**. Using this may result in unexpected side effects.
29
+ * More information in the [Customizing components Guide](https://atlantis.getjobber.com/guides/customizing-components).
30
+ */
31
+ readonly UNSAFE_style?: {
32
+ menu?: CSSProperties;
33
+ header?: CSSProperties;
34
+ action?: CSSProperties;
35
+ };
36
+ }
37
+ export interface MenuComposableProps extends MenuBaseProps {
38
+ /**
39
+ * Composable children-based API.
40
+ * The first child must be the Menu.Trigger
41
+ * The second child must be the Menu.Content
42
+ */
43
+ readonly children: ReactNode;
44
+ /**
45
+ * Used to make the menu a Controlled Component.
46
+ */
47
+ readonly open?: boolean;
48
+ /**
49
+ * This sets the default open state of the menu.
50
+ * By default the menu is closed.
51
+ * For use when the component is being used as an Uncontrolled Component.
52
+ */
53
+ readonly defaultOpen?: boolean;
54
+ /**
55
+ * Callback when the menu is opened or closed
56
+ */
57
+ readonly onOpenChange?: (isOpen: boolean) => void;
58
+ }
59
+ /**
60
+ * Backwards-compatible props for the items-based Menu API.
61
+ * Existing imports of `MenuProps` will continue to refer to the legacy shape.
62
+ */
63
+ export type MenuProps = MenuLegacyProps;
64
+ export interface SectionProps {
65
+ /**
66
+ * Defines the section header to further explain the group of actions.
67
+ */
68
+ header?: string;
69
+ /**
70
+ * List of actions.
71
+ */
72
+ actions: ActionProps[];
73
+ }
74
+ export interface SectionHeaderProps {
75
+ readonly text: string;
76
+ readonly UNSAFE_style?: CSSProperties;
77
+ readonly UNSAFE_className?: string;
78
+ }
79
+ export interface ActionProps {
80
+ /**
81
+ * Action label
82
+ */
83
+ readonly label: string;
84
+ /**
85
+ * Parent Section Label
86
+ */
87
+ readonly sectionLabel?: string;
88
+ /**
89
+ * Visual cue for the action label
90
+ */
91
+ readonly icon?: IconNames;
92
+ /**
93
+ * Color for the icon. Defaults to "icon".
94
+ */
95
+ readonly iconColor?: IconColorNames;
96
+ /**
97
+ * Visual style for the action button
98
+ */
99
+ readonly destructive?: boolean;
100
+ /**
101
+ * Inline style overrides for the action button
102
+ */
103
+ readonly UNSAFE_style?: CSSProperties;
104
+ /**
105
+ * Style class overrides for the action button
106
+ */
107
+ readonly UNSAFE_className?: string;
108
+ /**
109
+ * Callback when an action gets clicked
110
+ */
111
+ onClick?(event: React.MouseEvent<HTMLButtonElement>): void;
112
+ }
113
+ interface UnsafeProps {
114
+ readonly UNSAFE_style?: CSSProperties;
115
+ readonly UNSAFE_className?: string;
116
+ }
117
+ export interface MenuSectionComposableProps extends UnsafeProps {
118
+ /**
119
+ * Section content
120
+ * If no Menu.Header is provided, ariaLabel must be provided to identify the section to assistive technologies
121
+ */
122
+ readonly children: ReactNode;
123
+ /**
124
+ * Accessible label for the section
125
+ */
126
+ readonly ariaLabel?: string;
127
+ }
128
+ export interface MenuHeaderComposableProps extends UnsafeProps {
129
+ readonly children: ReactNode;
130
+ }
131
+ export interface MenuItemComposableProps extends UnsafeProps {
132
+ /**
133
+ * Apply destructive styling to the item label and icon.
134
+ */
135
+ readonly destructive?: boolean;
136
+ /**
137
+ * Item content.
138
+ */
139
+ readonly children: ReactNode;
140
+ readonly onClick?: (event?: React.MouseEvent) => void;
141
+ /**
142
+ * String representation of the item's content.
143
+ * Required for typeahead functionality.
144
+ */
145
+ readonly textValue: string;
146
+ /**
147
+ * Href for the item. When provided, renders as a link item.
148
+ */
149
+ readonly href?: string;
150
+ /**
151
+ * Target window for the link.
152
+ */
153
+ readonly target?: string;
154
+ /**
155
+ * Rel attribute for the link.
156
+ */
157
+ readonly rel?: string;
158
+ }
159
+ export interface MenuItemIconComposableProps extends IconProps {
160
+ }
161
+ export interface MenuContentComposableProps extends UnsafeProps {
162
+ readonly children: ReactNode;
163
+ }
164
+ export interface MenuTriggerComposableProps {
165
+ /**
166
+ * Accessible name for the trigger.
167
+ */
168
+ readonly ariaLabel?: string;
169
+ /**
170
+ * Trigger content.
171
+ * This MUST be an interactive element, such as Button. Note that any onClick is ignored.
172
+ * If you want to access the open event, use the onOpenChange on the Menu component.
173
+ * If it does not have an interactive role, or a focus style it will have issues.
174
+ */
175
+ readonly children: ReactNode;
176
+ }
177
+ export interface MenuSeparatorComposableProps extends UnsafeProps {
178
+ }
179
+ export type AnimationState = "unmounted" | "hidden" | "visible";
180
+ export interface MenuMobileUnderlayProps {
181
+ readonly animation: AnimationState;
182
+ }
183
+ export {};
@@ -0,0 +1,13 @@
1
+ export declare const SMALL_SCREEN_BREAKPOINT = 490;
2
+ export declare const MENU_OFFSET = 6;
3
+ export declare const MENU_MAX_HEIGHT_PERCENTAGE = 72;
4
+ export declare const Y_TRANSLATION_DESKTOP = 10;
5
+ export declare const Y_TRANSLATION_MOBILE = 150;
6
+ export declare const MENU_ANIMATION_CONFIG: {
7
+ duration: number;
8
+ type: string;
9
+ };
10
+ export declare const OVERLAY_ANIMATION_CONFIG: {
11
+ duration: number;
12
+ type: string;
13
+ };
@@ -8,6 +8,8 @@ require('@jobber/hooks');
8
8
  require('../floating-ui.react-cjs.js');
9
9
  require('react/jsx-runtime');
10
10
  require('react-dom');
11
+ require('../Tree-cjs.js');
12
+ require('../clsx-cjs.js');
11
13
  require('../Button-cjs.js');
12
14
  require('react-router-dom');
13
15
  require('../tslib.es6-cjs.js');
@@ -1 +1,2 @@
1
- export { Menu, type SectionProps, type ActionProps, type MenuProps, } from "./Menu";
1
+ export { Menu } from "./Menu";
2
+ export type { SectionProps, ActionProps, MenuProps } from "./Menu.types";
@@ -6,6 +6,8 @@ import '@jobber/hooks';
6
6
  import '../floating-ui.react-es.js';
7
7
  import 'react/jsx-runtime';
8
8
  import 'react-dom';
9
+ import '../Tree-es.js';
10
+ import '../clsx-es.js';
9
11
  import '../Button-es.js';
10
12
  import 'react-router-dom';
11
13
  import '../tslib.es6-es.js';