@jobber/components 8.21.1 → 8.23.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.
Files changed (93) hide show
  1. package/Dialog.d.ts +1 -0
  2. package/Dialog.js +17 -0
  3. package/dist/BottomSheet-cjs.js +34 -7
  4. package/dist/BottomSheet-es.js +34 -8
  5. package/dist/CSPContext-cjs.js +69 -0
  6. package/dist/CSPContext-es.js +46 -0
  7. package/dist/Card/index.cjs +3 -0
  8. package/dist/Card/index.mjs +3 -0
  9. package/dist/ComboboxChipRemove-cjs.js +54 -211
  10. package/dist/ComboboxChipRemove-es.js +8 -164
  11. package/dist/DataDump/index.cjs +3 -0
  12. package/dist/DataDump/index.mjs +3 -0
  13. package/dist/Dialog/Dialog.d.ts +3 -0
  14. package/dist/Dialog/Dialog.types.d.ts +205 -0
  15. package/dist/Dialog/DialogBottomSheet.d.ts +28 -0
  16. package/dist/Dialog/DialogModal.d.ts +20 -0
  17. package/dist/Dialog/constants.d.ts +1 -0
  18. package/dist/Dialog/dialogComposableShared.d.ts +53 -0
  19. package/dist/Dialog/dialogReturnFocus.d.ts +43 -0
  20. package/dist/Dialog/index.cjs +33 -0
  21. package/dist/Dialog/index.d.ts +4 -0
  22. package/dist/Dialog/index.mjs +25 -0
  23. package/dist/DrawerDescription-cjs.js +410 -0
  24. package/dist/DrawerDescription-es.js +383 -0
  25. package/dist/DrawerTitle-cjs.js +116 -0
  26. package/dist/DrawerTitle-es.js +92 -0
  27. package/dist/InputNumberExperimental-cjs.js +24 -23
  28. package/dist/InputNumberExperimental-es.js +3 -2
  29. package/dist/InternalBackdrop-es.js +3 -3
  30. package/dist/Menu/index.cjs +3 -0
  31. package/dist/Menu/index.mjs +3 -0
  32. package/dist/Menu-cjs.js +6 -4
  33. package/dist/Menu-es.js +6 -4
  34. package/dist/MenuSubmenuTrigger-cjs.js +53 -103
  35. package/dist/MenuSubmenuTrigger-es.js +55 -103
  36. package/dist/NumberFieldInput-cjs.js +9 -9
  37. package/dist/NumberFieldInput-es.js +3 -3
  38. package/dist/Page/index.cjs +3 -0
  39. package/dist/Page/index.mjs +3 -0
  40. package/dist/ScrollAreaViewport-cjs.js +921 -960
  41. package/dist/ScrollAreaViewport-es.js +917 -958
  42. package/dist/SelectGroupLabel-cjs.js +1924 -0
  43. package/dist/SelectGroupLabel-es.js +1888 -0
  44. package/dist/SelectPrimitive-cjs.js +112 -0
  45. package/dist/SelectPrimitive-es.js +110 -0
  46. package/dist/ToolbarRootContext-cjs.js +35 -0
  47. package/dist/ToolbarRootContext-es.js +14 -0
  48. package/dist/dialogReturnFocus-cjs.js +427 -0
  49. package/dist/dialogReturnFocus-es.js +423 -0
  50. package/dist/docs/SelectPrimitive/SelectPrimitive.md +326 -0
  51. package/dist/docs/index.md +1 -0
  52. package/dist/floating-ui.react-dom-cjs.js +1 -0
  53. package/dist/floating-ui.react-dom-es.js +2 -2
  54. package/dist/floating-ui.utils.dom-es.js +1 -1
  55. package/dist/index.cjs +15 -7
  56. package/dist/index.d.mts +1 -0
  57. package/dist/index.d.ts +1 -0
  58. package/dist/index.mjs +12 -7
  59. package/dist/primitives/BottomSheet/BottomSheet.d.ts +19 -1
  60. package/dist/primitives/BottomSheet/BottomSheet.types.d.ts +8 -0
  61. package/dist/primitives/BottomSheet/index.cjs +2 -0
  62. package/dist/primitives/BottomSheet/index.d.ts +1 -1
  63. package/dist/primitives/BottomSheet/index.mjs +2 -1
  64. package/dist/primitives/ComboboxPrimitive/index.cjs +3 -1
  65. package/dist/primitives/ComboboxPrimitive/index.mjs +3 -1
  66. package/dist/primitives/InputNumberExperimental/index.cjs +2 -1
  67. package/dist/primitives/InputNumberExperimental/index.mjs +2 -1
  68. package/dist/primitives/SelectPrimitive/SelectPrimitive.d.ts +63 -0
  69. package/dist/primitives/SelectPrimitive/index.cjs +29 -0
  70. package/dist/primitives/SelectPrimitive/index.d.ts +2 -0
  71. package/dist/primitives/SelectPrimitive/index.mjs +23 -0
  72. package/dist/primitives/SelectPrimitive/types.d.ts +16 -0
  73. package/dist/primitives/index.cjs +9 -1
  74. package/dist/primitives/index.d.ts +1 -0
  75. package/dist/primitives/index.mjs +8 -2
  76. package/dist/primitives/mergeClassName.d.ts +12 -0
  77. package/dist/resolveAriaLabelledBy-cjs.js +195 -0
  78. package/dist/resolveAriaLabelledBy-es.js +162 -0
  79. package/dist/styles.css +685 -0
  80. package/dist/unstyledPrimitives/index.cjs +434 -259
  81. package/dist/unstyledPrimitives/index.d.ts +2 -0
  82. package/dist/unstyledPrimitives/index.mjs +425 -252
  83. package/dist/useButton-cjs.js +2 -0
  84. package/dist/useButton-es.js +3 -2
  85. package/dist/useCompositeListItem-es.js +4 -4
  86. package/dist/useLabel-cjs.js +3 -329
  87. package/dist/useLabel-es.js +4 -299
  88. package/dist/useLabelableId-cjs.js +332 -0
  89. package/dist/useLabelableId-es.js +300 -0
  90. package/dist/useRenderElement-cjs.js +3 -0
  91. package/dist/useRenderElement-es.js +4 -1
  92. package/dist/utils/meta/meta.json +11 -1
  93. package/package.json +2 -2
@@ -1,11 +1,13 @@
1
1
  import * as React from 'react';
2
- import { B as useControlled, a as useStableCallback, j as useValueAsRef, c as useTransitionStatus, d as useIsoLayoutEffect, K as createGenericEventDetails, H as inputClear, G as inputChange, n as createChangeEventDetails, v as focusOut, a7 as outsidePress, g as getTarget, a6 as itemPress, f as useOpenChangeComplete, O as useValueChanged, D as none, an as inputPress, E as visuallyHiddenInput, F as visuallyHidden, m as contains, b as useTimeout, N as useButton, o as ownerDocument, s as stopEvent, p as listNavigation, a5 as closePress, u as useBaseUiId, R as isAndroid, ao as isFirefox, a2 as escapeKey, ap as clearPress, t as transitionStatusMapping, S as SafeReact, e as error, aq as chipRemovePress } from './useButton-es.js';
3
- import { f as formatErrorMessage, d as EMPTY_ARRAY, a as useRefWithInit, b as useMergedRefs, N as NOOP, E as EMPTY_OBJECT, u as useRenderElement } from './useRenderElement-es.js';
4
- import { a as useFormContext, b as useFieldRootContext, d as useLabelableId, e as useField, f as fieldValidityMapping, u as useLabelableContext, h as DEFAULT_FIELD_STATE_ATTRIBUTES, c as useLabel } from './useLabel-es.js';
5
- import { f as useFloatingRootContext, c as useListNavigation, d as useTypeahead, e as getPseudoElementBounds, C as CompositeList, a as useAnchorPositioning, g as getDisabledMountTransitionStyles, u as useCompositeListItem, I as IndexGuessBehavior } from './useCompositeListItem-es.js';
6
- import { n as createSelector, Z as useStore, s as useOpenInteractionType, y as useClick, t as useDismiss, w as useInteractions, x as useOnFirstRender, _ as Store, W as pressableTriggerOpenStateMapping, m as useDirection, A as triggerOpenStateMapping, q as FloatingPortal, p as popupStateMapping, v as useScrollLock, I as InternalBackdrop, r as inertValue, J as DROPDOWN_COLLISION_AVOIDANCE, o as FloatingFocusManager } from './InternalBackdrop-es.js';
2
+ import { E as useControlled, b as useStableCallback, n as useValueAsRef, k as useTransitionStatus, a as useIsoLayoutEffect, N as createGenericEventDetails, K as inputClear, J as inputChange, d as createChangeEventDetails, y as focusOut, U as outsidePress, g as getTarget, Z as itemPress, f as useOpenChangeComplete, Q as useValueChanged, G as none, ae as inputPress, r as contains, H as visuallyHiddenInput, I as visuallyHidden, h as useTimeout, c as useButton, o as ownerDocument, s as stopEvent, v as listNavigation, e as closePress, u as useBaseUiId, _ as isAndroid, af as isFirefox, a8 as escapeKey, ag as clearPress, t as transitionStatusMapping, S as SafeReact, j as error, ah as chipRemovePress } from './useButton-es.js';
3
+ import { f as formatErrorMessage, c as EMPTY_ARRAY, a as useRefWithInit, N as NOOP, E as EMPTY_OBJECT, b as useMergedRefs, u as useRenderElement } from './useRenderElement-es.js';
4
+ import { a as useFormContext, b as useFieldRootContext, c as useLabelableId, d as useField, f as fieldValidityMapping, u as useLabelableContext, e as DEFAULT_FIELD_STATE_ATTRIBUTES } from './useLabelableId-es.js';
5
+ import { u as useFloatingRootContext, a as useListNavigation, b as useTypeahead, g as getPseudoElementBounds, C as CompositeList, c as useAnchorPositioning, d as getDisabledMountTransitionStyles, e as useCompositeListItem, I as IndexGuessBehavior } from './useCompositeListItem-es.js';
6
+ import { h as hasNullItemLabel, c as compareItemEquality, i as stringifyAsLabel, j as isGroupedItems, s as stringifyAsValue, e as selectedValueIncludes, g as removeItem, f as findItemIndex, d as defaultItemEquality, r as resolveAriaLabelledBy, k as getDefaultLabelId, a as resolveMultipleLabels, b as resolveSelectedLabel } from './resolveAriaLabelledBy-es.js';
7
+ import { o as createSelector, S as Store, r as useStore, q as useOpenInteractionType, s as useClick, t as useDismiss, v as useInteractions, w as useOnFirstRender, x as pressableTriggerOpenStateMapping, n as useDirection, G as triggerOpenStateMapping, y as FloatingPortal, p as popupStateMapping, z as useScrollLock, I as InternalBackdrop, A as inertValue, B as DROPDOWN_COLLISION_AVOIDANCE, F as FloatingFocusManager } from './InternalBackdrop-es.js';
7
8
  import { jsx, jsxs } from 'react/jsx-runtime';
8
9
  import * as ReactDOM from 'react-dom';
10
+ import { u as useLabel } from './useLabel-es.js';
9
11
 
10
12
  const ComboboxRootContext = /*#__PURE__*/React.createContext(undefined);
11
13
  if (process.env.NODE_ENV !== "production") ComboboxRootContext.displayName = "ComboboxRootContext";
@@ -42,157 +44,6 @@ function useComboboxInputValueContext() {
42
44
  return React.useContext(ComboboxInputValueContext);
43
45
  }
44
46
 
45
- const defaultItemEquality = (itemValue, selectedValue) => Object.is(itemValue, selectedValue);
46
- function compareItemEquality(itemValue, selectedValue, comparer) {
47
- if (itemValue == null || selectedValue == null) {
48
- return Object.is(itemValue, selectedValue);
49
- }
50
- return comparer(itemValue, selectedValue);
51
- }
52
- function selectedValueIncludes(selectedValues, itemValue, comparer) {
53
- if (!selectedValues || selectedValues.length === 0) {
54
- return false;
55
- }
56
- return selectedValues.some(selectedValue => {
57
- if (selectedValue === undefined) {
58
- return false;
59
- }
60
- return compareItemEquality(itemValue, selectedValue, comparer);
61
- });
62
- }
63
- function findItemIndex(itemValues, selectedValue, comparer) {
64
- if (!itemValues || itemValues.length === 0) {
65
- return -1;
66
- }
67
- return itemValues.findIndex(itemValue => {
68
- if (itemValue === undefined) {
69
- return false;
70
- }
71
- return compareItemEquality(itemValue, selectedValue, comparer);
72
- });
73
- }
74
- function removeItem(selectedValues, itemValue, comparer) {
75
- return selectedValues.filter(selectedValue => !compareItemEquality(itemValue, selectedValue, comparer));
76
- }
77
-
78
- function serializeValue(value) {
79
- if (value == null) {
80
- return '';
81
- }
82
- if (typeof value === 'string') {
83
- return value;
84
- }
85
- try {
86
- return JSON.stringify(value);
87
- } catch {
88
- return String(value);
89
- }
90
- }
91
-
92
- function isGroupedItems(items) {
93
- return items != null && items.length > 0 && typeof items[0] === 'object' && items[0] != null && 'items' in items[0];
94
- }
95
-
96
- /**
97
- * Checks if the items array contains an item with a null value that has a non-null label.
98
- */
99
- function hasNullItemLabel(items) {
100
- if (!Array.isArray(items)) {
101
- return items != null && 'null' in items;
102
- }
103
- const arrayItems = items;
104
- if (isGroupedItems(arrayItems)) {
105
- for (const group of arrayItems) {
106
- for (const item of group.items) {
107
- if (item && item.value == null && item.label != null) {
108
- return true;
109
- }
110
- }
111
- }
112
- return false;
113
- }
114
- for (const item of arrayItems) {
115
- if (item && item.value == null && item.label != null) {
116
- return true;
117
- }
118
- }
119
- return false;
120
- }
121
- function stringifyAsLabel(item, itemToStringLabel) {
122
- if (itemToStringLabel && item != null) {
123
- return itemToStringLabel(item) ?? '';
124
- }
125
- if (item && typeof item === 'object') {
126
- if ('label' in item && item.label != null) {
127
- return String(item.label);
128
- }
129
- if ('value' in item) {
130
- return String(item.value);
131
- }
132
- }
133
- return serializeValue(item);
134
- }
135
- function stringifyAsValue(item, itemToStringValue) {
136
- if (itemToStringValue && item != null) {
137
- return itemToStringValue(item) ?? '';
138
- }
139
- if (item && typeof item === 'object' && 'value' in item && 'label' in item) {
140
- return serializeValue(item.value);
141
- }
142
- return serializeValue(item);
143
- }
144
- function resolveSelectedLabel(value, items, itemToStringLabel) {
145
- function fallback() {
146
- return stringifyAsLabel(value, itemToStringLabel);
147
- }
148
- if (itemToStringLabel && value != null) {
149
- return itemToStringLabel(value);
150
- }
151
-
152
- // Custom object with explicit label takes precedence
153
- if (value && typeof value === 'object' && 'label' in value && value.label != null) {
154
- return value.label;
155
- }
156
-
157
- // Items provided as plain record map
158
- if (items && !Array.isArray(items)) {
159
- return items[value] ?? fallback();
160
- }
161
-
162
- // Items provided as array (flat or grouped)
163
- if (Array.isArray(items)) {
164
- const arrayItems = items;
165
- const flatItems = isGroupedItems(arrayItems) ? arrayItems.flatMap(group => group.items) : arrayItems;
166
- if (value == null || typeof value !== 'object') {
167
- const match = flatItems.find(item => item.value === value);
168
- if (match && match.label != null) {
169
- return match.label;
170
- }
171
- return fallback();
172
- }
173
-
174
- // Object without explicit label: try matching by its `value` property
175
- if ('value' in value) {
176
- const match = flatItems.find(item => item && item.value === value.value);
177
- if (match && match.label != null) {
178
- return match.label;
179
- }
180
- }
181
- }
182
- return fallback();
183
- }
184
- function resolveMultipleLabels(values, items, itemToStringLabel) {
185
- return values.reduce((acc, value, index) => {
186
- if (index > 0) {
187
- acc.push(', ');
188
- }
189
- acc.push(/*#__PURE__*/jsx(React.Fragment, {
190
- children: resolveSelectedLabel(value, items, itemToStringLabel)
191
- }, index));
192
- return acc;
193
- }, []);
194
- }
195
-
196
47
  const selectors = {
197
48
  id: createSelector(state => state.id),
198
49
  labelId: createSelector(state => state.labelId),
@@ -1393,13 +1244,6 @@ const triggerStateAttributesMapping = {
1393
1244
  } : null
1394
1245
  };
1395
1246
 
1396
- function getDefaultLabelId(id) {
1397
- return id == null ? undefined : `${id}-label`;
1398
- }
1399
- function resolveAriaLabelledBy(fieldLabelId, localLabelId) {
1400
- return fieldLabelId ?? localLabelId;
1401
- }
1402
-
1403
1247
  const BOUNDARY_OFFSET = 2;
1404
1248
 
1405
1249
  /**
@@ -3363,4 +3207,4 @@ const ComboboxChipRemove = /*#__PURE__*/React.forwardRef(function ComboboxChipRe
3363
3207
  });
3364
3208
  if (process.env.NODE_ENV !== "production") ComboboxChipRemove.displayName = "ComboboxChipRemove";
3365
3209
 
3366
- export { useCoreFilter as A, AriaCombobox as B, ComboboxRoot as C, stringifyAsLabel as D, useComboboxInputValueContext as E, ComboboxLabel as a, ComboboxValue as b, ComboboxInput as c, ComboboxInputGroup as d, ComboboxTrigger as e, ComboboxList as f, ComboboxStatus as g, ComboboxPortal as h, ComboboxBackdrop as i, ComboboxPositioner as j, ComboboxPopup as k, ComboboxArrow as l, ComboboxIcon as m, ComboboxGroup as n, ComboboxGroupLabel as o, ComboboxItem as p, ComboboxItemIndicator as q, ComboboxChips as r, ComboboxChip as s, ComboboxChipRemove as t, ComboboxRow as u, ComboboxCollection as v, ComboboxEmpty as w, ComboboxClear as x, useComboboxFilter as y, useFilteredItems as z };
3210
+ export { useCoreFilter as A, AriaCombobox as B, ComboboxRoot as C, useComboboxInputValueContext as D, ComboboxLabel as a, ComboboxValue as b, ComboboxInput as c, ComboboxInputGroup as d, ComboboxTrigger as e, ComboboxList as f, ComboboxStatus as g, ComboboxPortal as h, ComboboxBackdrop as i, ComboboxPositioner as j, ComboboxPopup as k, ComboboxArrow as l, ComboboxIcon as m, ComboboxGroup as n, ComboboxGroupLabel as o, ComboboxItem as p, ComboboxItemIndicator as q, ComboboxChips as r, ComboboxChip as s, ComboboxChipRemove as t, ComboboxRow as u, ComboboxCollection as v, ComboboxEmpty as w, ComboboxClear as x, useComboboxFilter as y, useFilteredItems as z };
@@ -28,11 +28,14 @@ require('../BottomSheet-cjs.js');
28
28
  require('../ScrollAreaViewport-cjs.js');
29
29
  require('../InternalBackdrop-cjs.js');
30
30
  require('../useButton-cjs.js');
31
+ require('../CSPContext-cjs.js');
31
32
  require('../clamp-cjs.js');
32
33
  require('../OverlaySeparator-cjs.js');
33
34
  require('../Separator-cjs.js');
35
+ require('../DrawerTitle-cjs.js');
34
36
  require('../MenuSubmenuTrigger-cjs.js');
35
37
  require('../useCompositeListItem-cjs.js');
38
+ require('../ToolbarRootContext-cjs.js');
36
39
  require('../Content-cjs.js');
37
40
  require('../Emphasis-cjs.js');
38
41
 
@@ -26,10 +26,13 @@ import '../BottomSheet-es.js';
26
26
  import '../ScrollAreaViewport-es.js';
27
27
  import '../InternalBackdrop-es.js';
28
28
  import '../useButton-es.js';
29
+ import '../CSPContext-es.js';
29
30
  import '../clamp-es.js';
30
31
  import '../OverlaySeparator-es.js';
31
32
  import '../Separator-es.js';
33
+ import '../DrawerTitle-es.js';
32
34
  import '../MenuSubmenuTrigger-es.js';
33
35
  import '../useCompositeListItem-es.js';
36
+ import '../ToolbarRootContext-es.js';
34
37
  import '../Content-es.js';
35
38
  import '../Emphasis-es.js';
@@ -0,0 +1,3 @@
1
+ import type { DialogComponent } from "./Dialog.types";
2
+ declare const Dialog: DialogComponent;
3
+ export { Dialog };
@@ -0,0 +1,205 @@
1
+ import type { CSSProperties, ComponentPropsWithRef, ComponentPropsWithoutRef, FunctionComponent, ReactElement, ReactNode } from "react";
2
+ import type { Dialog as BaseDialog } from "../unstyledPrimitives";
3
+ import type { ButtonProps } from "../Button";
4
+ type BaseUIPropsToExclude = "render" | "className" | "style" | "ref" | "children";
5
+ /** Width of the dialog; `fullScreen` fills the viewport. */
6
+ export type DialogSize = "small" | "base" | "large" | "fullScreen";
7
+ /** `alertdialog` blocks outside/backdrop dismissal; `dialog` allows it. */
8
+ export type DialogType = "dialog" | "alertdialog";
9
+ /**
10
+ * Shared `className`/`style` contract for the composable Dialog parts.
11
+ */
12
+ export interface DialogBaseProps {
13
+ /** Class name applied to the part's root element. */
14
+ readonly className?: string;
15
+ /** Inline styles applied to the part's root element. */
16
+ readonly style?: CSSProperties;
17
+ }
18
+ export type DialogHandle<Payload = unknown> = BaseDialog.Handle<Payload>;
19
+ export interface DialogRootProps<Payload = unknown> extends Pick<BaseDialog.Root.Props<Payload>, "open" | "onOpenChange" | "handle" | "triggerId" | "defaultTriggerId" | "onOpenChangeComplete"> {
20
+ /**
21
+ * Called when the user asks to close (escape, backdrop, dismiss button).
22
+ * Receives BaseUI's change-event details (reason + originating event),
23
+ * matching how BaseUI types its open/close callbacks.
24
+ */
25
+ readonly onRequestClose?: (eventDetails: BaseDialog.Root.ChangeEventDetails) => void;
26
+ /**
27
+ * Width of the dialog.
28
+ * On mobile when this is set to "fullScreen" the bottom sheet will be full screen (100% height).
29
+ * @default "base"
30
+ */
31
+ readonly size?: DialogSize;
32
+ /**
33
+ * Type of the dialog. An `alertdialog` requires the user to choose an action
34
+ * before it can be closed (no outside/backdrop dismissal).
35
+ * @default "dialog"
36
+ */
37
+ readonly type?: DialogType;
38
+ /**
39
+ * @see {@link https://base-ui.com/react/components/dialog#DialogPopup-finalFocus}
40
+ * */
41
+ readonly finalFocus?: BaseDialog.Popup.Props["finalFocus"];
42
+ /**
43
+ * The content of the dialog. This can be a regular React node or a render function that receives the payload of the active trigger.
44
+ */
45
+ readonly children?: ReactNode | ((state: {
46
+ payload: Payload | undefined;
47
+ }) => ReactNode);
48
+ }
49
+ /** Props BaseUI passes to a `Dialog.Trigger` `render` callback. */
50
+ export type DialogTriggerRenderProps = ComponentPropsWithRef<"button">;
51
+ /** A custom trigger element, or a function that renders one from BaseUI props. */
52
+ export type DialogTriggerRender = ReactElement | ((props: DialogTriggerRenderProps) => ReactElement);
53
+ interface DialogTriggerSharedProps<Payload> extends DialogBaseProps, Omit<BaseDialog.Trigger.Props, BaseUIPropsToExclude | "handle" | "payload"> {
54
+ /**
55
+ * Links a detached trigger to a `Dialog` with the matching `handle`, when the
56
+ * trigger can't be nested inside the `Dialog`.
57
+ */
58
+ readonly handle?: DialogHandle<Payload>;
59
+ /**
60
+ * Data passed to the dialog when this trigger opens it (used with `handle`).
61
+ */
62
+ readonly payload?: Payload;
63
+ }
64
+ interface DialogTriggerDefaultProps<Payload> extends DialogTriggerSharedProps<Payload> {
65
+ /** Trigger content; an Atlantis `<Button>` or raw text. */
66
+ readonly children: ReactNode;
67
+ readonly render?: undefined;
68
+ }
69
+ interface DialogTriggerCustomRenderProps<Payload> extends DialogTriggerSharedProps<Payload> {
70
+ /** Optional content forwarded to the rendered element. */
71
+ readonly children?: ReactNode;
72
+ /** Renders a custom trigger element in place of the default `<Button>`. */
73
+ readonly render: DialogTriggerRender;
74
+ }
75
+ /**
76
+ * Either the default
77
+ * (`children` required, `render` omitted) or custom-render (`render` required,
78
+ * `children` optional).
79
+ */
80
+ export type DialogTriggerProps<Payload = unknown> = DialogTriggerDefaultProps<Payload> | DialogTriggerCustomRenderProps<Payload>;
81
+ export interface DialogContentProps extends DialogBaseProps, Omit<BaseDialog.Popup.Props, BaseUIPropsToExclude | "role" | "finalFocus" | "initialFocus"> {
82
+ readonly children: ReactNode;
83
+ /**
84
+ * @see {@link https://base-ui.com/react/components/dialog#DialogPopup-render}
85
+ */
86
+ readonly render?: BaseDialog.Popup.Props["render"];
87
+ }
88
+ export interface DialogHeaderProps extends DialogBaseProps, Omit<ComponentPropsWithoutRef<"div">, BaseUIPropsToExclude> {
89
+ /**
90
+ * Header content — commonly a `Dialog.Title` and a `Dialog.Close`. The header
91
+ * only owns layout; it does not impose typography or actions.
92
+ */
93
+ readonly children: ReactNode;
94
+ }
95
+ export interface DialogTitleProps extends DialogBaseProps, Omit<BaseDialog.Title.Props, BaseUIPropsToExclude> {
96
+ /**
97
+ * Title text. Rendered as a `Heading` and auto-wired to the dialog's
98
+ * `aria-labelledby`.
99
+ */
100
+ readonly children: ReactNode;
101
+ }
102
+ /** Props BaseUI passes to a `Dialog.Close` `render` callback. */
103
+ export type DialogCloseRenderProps = ComponentPropsWithRef<"button">;
104
+ /** A custom dismiss element, or a function that renders one from BaseUI props. */
105
+ export type DialogCloseRender = ReactElement | ((props: DialogCloseRenderProps) => ReactElement);
106
+ export interface DialogCloseProps extends DialogBaseProps, Omit<BaseDialog.Close.Props, BaseUIPropsToExclude> {
107
+ /**
108
+ * Optional content for the dismiss control. An Atlantis `<Button>` is adapted
109
+ * automatically; any other valid element is used as-is. The default ButtonDismiss is used if no children or render is provided.
110
+ */
111
+ readonly children?: ReactNode;
112
+ /**
113
+ * Renders a custom dismiss element in place of the default `ButtonDismiss`
114
+ * Pass an element or a function that receives the
115
+ * BaseUI close props (so the element stays wired to close the dialog).
116
+ */
117
+ readonly render?: DialogCloseRender;
118
+ }
119
+ export interface DialogBodyProps extends DialogBaseProps, Omit<BaseDialog.Description.Props, BaseUIPropsToExclude> {
120
+ /** Body content; describes the dialog (wired to `aria-describedby`). */
121
+ readonly children: ReactNode;
122
+ /**
123
+ * Removes body padding
124
+ * @default false
125
+ */
126
+ readonly fullBleed?: boolean;
127
+ }
128
+ export interface DialogFooterProps extends DialogBaseProps, Omit<ComponentPropsWithoutRef<"div">, BaseUIPropsToExclude> {
129
+ /**
130
+ * Footer content. Commonly a `Dialog.Actions`, but the footer is a generic
131
+ * region — it can hold anything (a note, a checkbox, a custom layout).
132
+ */
133
+ readonly children: ReactNode;
134
+ }
135
+ /**
136
+ * `Dialog.ScrollArea` — the advanced scroll region. Content placed inside it
137
+ * scrolls (and owns the scrollbar); parts left as siblings of it in
138
+ * `Dialog.Content` stay pinned. Most dialogs don't need it — `Dialog.Body` is
139
+ * the scroll region for the common case.
140
+ */
141
+ export interface DialogScrollAreaProps extends DialogBaseProps {
142
+ /**
143
+ * Content that scrolls together — typically a `Dialog.Body` and a non-pinned
144
+ * `Dialog.Header`/`Dialog.Footer`.
145
+ */
146
+ readonly children: ReactNode;
147
+ }
148
+ export type DialogShellRootProps = BaseDialog.Root.Props;
149
+ /** Value shared with the Dialog parts via context. */
150
+ export interface DialogContextValue {
151
+ /** Dialog vs. alertdialog mode. */
152
+ readonly type: DialogType;
153
+ /** Configured dialog width. */
154
+ readonly size: DialogSize;
155
+ /**
156
+ * Whether the dialog should present as a mobile bottom sheet. Computed once at
157
+ * the root (like Menu's shell selection) and read by the parts.
158
+ */
159
+ readonly isMobile: boolean;
160
+ readonly finalFocus?: BaseDialog.Popup.Props["finalFocus"];
161
+ }
162
+ export interface DialogProviderProps extends DialogContextValue {
163
+ readonly children: ReactNode;
164
+ }
165
+ /** The assembled `Dialog` component: a root with the parts attached. */
166
+ export interface DialogComponent {
167
+ <Payload = unknown>(props: DialogRootProps<Payload>): ReactElement;
168
+ Trigger: <Payload = unknown>(props: DialogTriggerProps<Payload>) => ReactElement;
169
+ Content: FunctionComponent<DialogContentProps>;
170
+ Header: FunctionComponent<DialogHeaderProps>;
171
+ Title: FunctionComponent<DialogTitleProps>;
172
+ Close: FunctionComponent<DialogCloseProps>;
173
+ Body: FunctionComponent<DialogBodyProps>;
174
+ Footer: FunctionComponent<DialogFooterProps>;
175
+ Actions: FunctionComponent<DialogActionsProps>;
176
+ ScrollArea: FunctionComponent<DialogScrollAreaProps>;
177
+ createHandle: <Payload = unknown>() => DialogHandle<Payload>;
178
+ }
179
+ export type DialogActionsAlign = "left" | "right" | "fullWidth";
180
+ interface DialogActionsBaseProps extends DialogBaseProps, Omit<ComponentPropsWithoutRef<"div">, "className" | "style" | "children"> {
181
+ /** Primary action (right). */
182
+ readonly primary?: ButtonProps | ReactElement;
183
+ /** Secondary action (right, subtle). */
184
+ readonly secondary?: ButtonProps | ReactElement;
185
+ /** Tertiary/destructive action (left). */
186
+ readonly tertiary?: ButtonProps | ReactElement;
187
+ /**
188
+ * Layout for the right-hand action group.
189
+ * @default "right"
190
+ */
191
+ readonly align?: DialogActionsAlign;
192
+ }
193
+ /**
194
+ * At least one of `primary`, `secondary`, or `tertiary` is required; any other
195
+ * combination of the three is allowed. Modeled as a union where each member
196
+ * pins one action as required while the rest stay optional from the base.
197
+ */
198
+ export type DialogActionsProps = (DialogActionsBaseProps & {
199
+ readonly primary: ButtonProps | ReactElement;
200
+ }) | (DialogActionsBaseProps & {
201
+ readonly secondary: ButtonProps | ReactElement;
202
+ }) | (DialogActionsBaseProps & {
203
+ readonly tertiary: ButtonProps | ReactElement;
204
+ });
205
+ export {};
@@ -0,0 +1,28 @@
1
+ import React from "react";
2
+ import type { DialogBodyProps, DialogCloseProps, DialogContentProps, DialogScrollAreaProps, DialogShellRootProps, DialogTitleProps, DialogTriggerProps } from "./Dialog.types";
3
+ import { SharedDialogFooter, SharedDialogHeader } from "./dialogComposableShared";
4
+ declare function DialogBottomSheetRoot(props: DialogShellRootProps): React.JSX.Element;
5
+ declare function DialogBottomSheetTrigger<Payload = unknown>(props: DialogTriggerProps<Payload>): React.JSX.Element;
6
+ declare function DialogBottomSheetContent({ children, className, style, ...rest }: DialogContentProps): React.JSX.Element;
7
+ declare function DialogBottomSheetTitle({ children, ...rest }: DialogTitleProps): React.JSX.Element;
8
+ declare function DialogBottomSheetClose({ children, render, ...rest }: DialogCloseProps): React.JSX.Element;
9
+ /**
10
+ * The sheet's scroll region — backed by the BottomSheet primitive's styled
11
+ * scroll area (native scrollbar + bottom fade). Marks its content as inside a
12
+ * scroll area so a nested `Dialog.Body` renders plain and sticky regions know
13
+ * they scroll.
14
+ */
15
+ declare function DialogBottomSheetScrollArea({ children, className, style, }: DialogScrollAreaProps): React.JSX.Element;
16
+ declare function DialogBottomSheetBody({ children, fullBleed, className, style, ...rest }: DialogBodyProps): React.JSX.Element;
17
+ /** Mobile shell: a bottom sheet built on the BottomSheet/Drawer primitives. */
18
+ export declare const DialogBottomSheet: typeof DialogBottomSheetRoot & {
19
+ Trigger: typeof DialogBottomSheetTrigger;
20
+ Content: typeof DialogBottomSheetContent;
21
+ Header: typeof SharedDialogHeader;
22
+ Title: typeof DialogBottomSheetTitle;
23
+ Close: typeof DialogBottomSheetClose;
24
+ Body: typeof DialogBottomSheetBody;
25
+ Footer: typeof SharedDialogFooter;
26
+ ScrollArea: typeof DialogBottomSheetScrollArea;
27
+ };
28
+ export {};
@@ -0,0 +1,20 @@
1
+ import React from "react";
2
+ import type { DialogBodyProps, DialogCloseProps, DialogContentProps, DialogShellRootProps, DialogTitleProps, DialogTriggerProps } from "./Dialog.types";
3
+ import { DialogScrollArea, SharedDialogFooter, SharedDialogHeader } from "./dialogComposableShared";
4
+ declare function DialogModalRoot(props: DialogShellRootProps): React.JSX.Element;
5
+ declare function DialogModalTrigger<Payload = unknown>({ children, render, handle, payload, className, style, ...rest }: DialogTriggerProps<Payload>): React.JSX.Element;
6
+ declare function DialogModalContent({ children, className, style, ...rest }: DialogContentProps): React.JSX.Element;
7
+ declare function DialogModalTitle({ children, ...rest }: DialogTitleProps): React.JSX.Element;
8
+ declare function DialogModalClose({ children, render, ...rest }: DialogCloseProps): React.JSX.Element;
9
+ declare function DialogModalBody({ children, fullBleed, className, style, ...rest }: DialogBodyProps): React.JSX.Element;
10
+ export declare const DialogModal: typeof DialogModalRoot & {
11
+ Trigger: typeof DialogModalTrigger;
12
+ Content: typeof DialogModalContent;
13
+ Header: typeof SharedDialogHeader;
14
+ Title: typeof DialogModalTitle;
15
+ Close: typeof DialogModalClose;
16
+ Body: typeof DialogModalBody;
17
+ Footer: typeof SharedDialogFooter;
18
+ ScrollArea: typeof DialogScrollArea;
19
+ };
20
+ export {};
@@ -0,0 +1 @@
1
+ export declare const SMALL_SCREEN_BREAKPOINT = 490;
@@ -0,0 +1,53 @@
1
+ import React from "react";
2
+ import type { DialogActionsProps, DialogCloseRender, DialogContextValue, DialogFooterProps, DialogHeaderProps, DialogProviderProps, DialogScrollAreaProps, DialogTriggerRender } from "./Dialog.types";
3
+ /**
4
+ * Resolves the trigger element for `Dialog.Trigger`. Copied from Menu's
5
+ * `resolveMenuTriggerRender` so an Atlantis `<Button>` works as a trigger via
6
+ * `children` or `render` identically in both shells. Raw text children are
7
+ * wrapped in a default `Button`.
8
+ */
9
+ export declare function resolveComposableTriggerRender({ children, render, }: {
10
+ readonly children?: React.ReactNode;
11
+ readonly render?: DialogTriggerRender;
12
+ }): React.ReactElement<unknown, string | React.JSXElementConstructor<any>> | ((props: React.DetailedHTMLProps<React.ButtonHTMLAttributes<HTMLButtonElement>, HTMLButtonElement>) => React.JSX.Element);
13
+ /**
14
+ * Resolves the dismiss element for `Dialog.Close`, mirroring
15
+ * `resolveComposableTriggerRender` so a custom render works in both shells.
16
+ * Falls back to the subtle "remove" `ButtonDismiss` when neither `render` nor
17
+ * `children` are supplied. An Atlantis `<Button>`/`<ButtonDismiss>` passed via
18
+ * `render` or `children` is adapted; any other valid element is used as-is.
19
+ */
20
+ export declare function resolveComposableCloseRender({ children, render, }: {
21
+ readonly children?: React.ReactNode;
22
+ readonly render?: DialogCloseRender;
23
+ }): React.ReactElement<unknown, string | React.JSXElementConstructor<any>> | ((props: React.DetailedHTMLProps<React.ButtonHTMLAttributes<HTMLButtonElement>, HTMLButtonElement>) => React.JSX.Element);
24
+ /** Supplies the static config (type/size/isMobile/finalFocus) to the parts. */
25
+ export declare function DialogProvider({ children, type, size, isMobile, finalFocus, }: DialogProviderProps): React.JSX.Element;
26
+ /** Reads the Dialog config; throws if a part is used outside `<Dialog>`. */
27
+ export declare function useDialogContext(): DialogContextValue;
28
+ /**
29
+ * True when the current parts render inside a `Dialog.ScrollArea` (or the scroll
30
+ * region a `Dialog.Body` wraps itself in). Header/Footer read it to know whether
31
+ * they are sticky (not nested inside a `Dialog.ScrollArea`) or scroll (nested inside a `Dialog.ScrollArea`); `Dialog.Body`
32
+ * reads it to avoid creating a nested scroller.
33
+ */
34
+ export declare const DialogScrollAreaContext: React.Context<boolean>;
35
+ /** Whether the current part is nested inside a `Dialog.ScrollArea`. */
36
+ export declare function useInsideDialogScrollArea(): boolean;
37
+ /**
38
+ * The modal's scroll region — a BaseUI `ScrollArea` that scrolls its content
39
+ * with the browser's native scrollbar (re-enabled in Dialog.module.css). Content
40
+ * placed inside it scrolls and owns the scrollbar; `Dialog.Body` used on its own
41
+ * wraps itself in one. (The bottom sheet uses `DialogBottomSheetScrollArea`,
42
+ * backed by the BottomSheet primitive's scroll area, for its fade.)
43
+ */
44
+ export declare function DialogScrollArea({ children, className, style, }: DialogScrollAreaProps): React.JSX.Element;
45
+ /** Layout-only header row; sticky unless nested inside a `Dialog.ScrollArea`. */
46
+ export declare function SharedDialogHeader({ children, className, style, ...rest }: DialogHeaderProps): React.JSX.Element;
47
+ /** Generic footer region; sticky unless nested inside a `Dialog.ScrollArea`. */
48
+ export declare function SharedDialogFooter({ children, className, style, ...rest }: DialogFooterProps): React.JSX.Element;
49
+ /**
50
+ * The action-button layout: tertiary on the left, primary/secondary grouped on
51
+ * the right. Drop it inside a `Dialog.Footer`.
52
+ */
53
+ export declare function DialogActions({ primary, secondary, tertiary, align, className, style, ...rest }: DialogActionsProps): React.JSX.Element;
@@ -0,0 +1,43 @@
1
+ import type { RefObject } from "react";
2
+ /**
3
+ * The first focusable element within `container` (the container itself counts if
4
+ * it is focusable). Skips hidden elements. Returns `null` when nothing inside is
5
+ * focusable.
6
+ */
7
+ export declare function getFirstFocusableWithin(container: HTMLElement | null): HTMLElement | null;
8
+ /** Options for {@link getDialogReturnFocus}. */
9
+ export interface DialogReturnFocusOptions {
10
+ /**
11
+ * The element focus should return to when it is still in the DOM at close
12
+ * time — typically the trigger (an autocomplete/combobox input, a button).
13
+ */
14
+ readonly trigger?: RefObject<HTMLElement | null> | null;
15
+ /**
16
+ * A container that stays mounted while the trigger may unmount. When the
17
+ * trigger is gone, focus returns to the first focusable element inside it —
18
+ * e.g. the card that replaced the trigger. Keep it scoped tightly around the
19
+ * region that swaps so the "closest" element is the one the user expects.
20
+ */
21
+ readonly boundary: RefObject<HTMLElement | null>;
22
+ }
23
+ /**
24
+ * Builds a `finalFocus` callback for `Dialog` that keeps keyboard focus near the
25
+ * trigger even when the trigger unmounts while the dialog is open (e.g. an
26
+ * autocomplete "Create" action whose row is replaced by a card on save).
27
+ *
28
+ * Resolution order on close:
29
+ * 1. the `trigger`, if it is still connected;
30
+ * 2. otherwise the first focusable element inside `boundary` (the "closest"
31
+ * landing spot);
32
+ * 3. otherwise `null`, which lets BaseUI fall back to its default behavior.
33
+ *
34
+ * @example
35
+ * const triggerRef = useRef<HTMLInputElement>(null);
36
+ * const boundaryRef = useRef<HTMLDivElement>(null);
37
+ * <div ref={boundaryRef}>…</div>
38
+ * <Dialog
39
+ * handle={handle}
40
+ * finalFocus={getDialogReturnFocus({ trigger: triggerRef, boundary: boundaryRef })}
41
+ * >
42
+ */
43
+ export declare function getDialogReturnFocus({ trigger, boundary, }: DialogReturnFocusOptions): () => HTMLElement | null;
@@ -0,0 +1,33 @@
1
+ 'use strict';
2
+
3
+ var dialogReturnFocus = require('../dialogReturnFocus-cjs.js');
4
+ require('../tslib.es6-cjs.js');
5
+ require('react');
6
+ require('@jobber/hooks');
7
+ require('classnames');
8
+ require('../buttonRenderAdapter-cjs.js');
9
+ require('../Button-cjs.js');
10
+ require('react-router-dom');
11
+ require('../Icon-cjs.js');
12
+ require('@jobber/design');
13
+ require('../Typography-cjs.js');
14
+ require('../useRenderElement-cjs.js');
15
+ require('../ScrollAreaViewport-cjs.js');
16
+ require('../InternalBackdrop-cjs.js');
17
+ require('../index.esm-cjs.js');
18
+ require('../floating-ui.utils.dom-cjs.js');
19
+ require('../useButton-cjs.js');
20
+ require('react-dom');
21
+ require('react/jsx-runtime');
22
+ require('../CSPContext-cjs.js');
23
+ require('../clamp-cjs.js');
24
+ require('../Heading-cjs.js');
25
+ require('../BottomSheet-cjs.js');
26
+ require('../DrawerTitle-cjs.js');
27
+ require('../DrawerDescription-cjs.js');
28
+
29
+
30
+
31
+ exports.Dialog = dialogReturnFocus.Dialog;
32
+ exports.getDialogReturnFocus = dialogReturnFocus.getDialogReturnFocus;
33
+ exports.getFirstFocusableWithin = dialogReturnFocus.getFirstFocusableWithin;
@@ -0,0 +1,4 @@
1
+ export { Dialog } from "./Dialog";
2
+ export { getDialogReturnFocus, getFirstFocusableWithin, } from "./dialogReturnFocus";
3
+ export type { DialogReturnFocusOptions } from "./dialogReturnFocus";
4
+ export type { DialogBodyProps, DialogCloseProps, DialogCloseRender, DialogContentProps, DialogFooterProps, DialogHandle, DialogHeaderProps, DialogRootProps, DialogSize, DialogTitleProps, DialogTriggerProps, DialogTriggerRender, DialogType, } from "./Dialog.types";
@@ -0,0 +1,25 @@
1
+ export { D as Dialog, g as getDialogReturnFocus, a as getFirstFocusableWithin } from '../dialogReturnFocus-es.js';
2
+ import '../tslib.es6-es.js';
3
+ import 'react';
4
+ import '@jobber/hooks';
5
+ import 'classnames';
6
+ import '../buttonRenderAdapter-es.js';
7
+ import '../Button-es.js';
8
+ import 'react-router-dom';
9
+ import '../Icon-es.js';
10
+ import '@jobber/design';
11
+ import '../Typography-es.js';
12
+ import '../useRenderElement-es.js';
13
+ import '../ScrollAreaViewport-es.js';
14
+ import '../InternalBackdrop-es.js';
15
+ import '../index.esm-es.js';
16
+ import '../floating-ui.utils.dom-es.js';
17
+ import '../useButton-es.js';
18
+ import 'react-dom';
19
+ import 'react/jsx-runtime';
20
+ import '../CSPContext-es.js';
21
+ import '../clamp-es.js';
22
+ import '../Heading-es.js';
23
+ import '../BottomSheet-es.js';
24
+ import '../DrawerTitle-es.js';
25
+ import '../DrawerDescription-es.js';