@jobber/components 9.5.2 → 9.5.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.
@@ -1,5 +1,5 @@
1
1
  import * as React from 'react';
2
- import { u as useDialogRootContext, h as useDialogPortalContext, i as DialogStore } from './ScrollAreaViewport-es.js';
2
+ import { u as useDialogRootContext, l as useDialogPortalContext, m as DialogStore } from './ScrollAreaViewport-es.js';
3
3
  import { u as useRenderElement } from './useRenderElement-es.js';
4
4
  import { p as popupStateMapping, t as transitionStatusMapping, u as useBaseUiId, C as CommonPopupDataAttributes, f as useOpenChangeComplete, h as createDefaultInitialFocus, F as FOCUSABLE_POPUP_PROPS, i as FloatingFocusManager, d as createChangeEventDetails, j as imperativeAction } from './useScrollLock-es.js';
5
5
  import { C as COMPOSITE_KEYS } from './scrollEdges-es.js';
package/dist/Menu-cjs.js CHANGED
@@ -90,7 +90,7 @@ function MenuLegacy({ activator, items, UNSAFE_className, UNSAFE_style, }) {
90
90
  [styles$2.fullWidth]: fullWidth,
91
91
  });
92
92
  jobberHooks.useRefocusOnActivator(visible);
93
- const isLargeScreen = width >= SMALL_SCREEN_BREAKPOINT;
93
+ const isLargeScreen = width !== undefined && width >= SMALL_SCREEN_BREAKPOINT;
94
94
  const middleware = React.useMemo(() => {
95
95
  if (isLargeScreen) {
96
96
  return [
@@ -905,8 +905,7 @@ function useMenuShell() {
905
905
  return isMobile ? MenuBottomSheet : MenuDropdown;
906
906
  }
907
907
  function MenuComposableRoot(props) {
908
- const { width } = jobberHooks.useWindowDimensions();
909
- const isMobile = width !== undefined && width <= SMALL_SCREEN_BREAKPOINT;
908
+ const isMobile = jobberHooks.useIsSmallScreen();
910
909
  const RootComponent = isMobile ? MenuBottomSheet : MenuDropdown;
911
910
  return (React.createElement(MenuContext.Provider, { value: { isMobile } },
912
911
  React.createElement(RootComponent, { onOpenChange: props.onOpenChange, open: props.open, defaultOpen: props.defaultOpen }, props.children)));
package/dist/Menu-es.js CHANGED
@@ -1,5 +1,5 @@
1
1
  import React__default, { useState, useRef, useId, useMemo } from 'react';
2
- import { useWindowDimensions, useRefocusOnActivator } from '@jobber/hooks';
2
+ import { useWindowDimensions, useRefocusOnActivator, useIsSmallScreen } from '@jobber/hooks';
3
3
  import classnames from 'classnames';
4
4
  import { AnimatePresence, motion } from 'framer-motion';
5
5
  import { u as useFloating, c as useDismiss, g as useListNavigation, d as useInteractions, F as FloatingPortal } from './floating-ui.react-es.js';
@@ -88,7 +88,7 @@ function MenuLegacy({ activator, items, UNSAFE_className, UNSAFE_style, }) {
88
88
  [styles$2.fullWidth]: fullWidth,
89
89
  });
90
90
  useRefocusOnActivator(visible);
91
- const isLargeScreen = width >= SMALL_SCREEN_BREAKPOINT;
91
+ const isLargeScreen = width !== undefined && width >= SMALL_SCREEN_BREAKPOINT;
92
92
  const middleware = useMemo(() => {
93
93
  if (isLargeScreen) {
94
94
  return [
@@ -903,8 +903,7 @@ function useMenuShell() {
903
903
  return isMobile ? MenuBottomSheet : MenuDropdown;
904
904
  }
905
905
  function MenuComposableRoot(props) {
906
- const { width } = useWindowDimensions();
907
- const isMobile = width !== undefined && width <= SMALL_SCREEN_BREAKPOINT;
906
+ const isMobile = useIsSmallScreen();
908
907
  const RootComponent = isMobile ? MenuBottomSheet : MenuDropdown;
909
908
  return (React__default.createElement(MenuContext.Provider, { value: { isMobile } },
910
909
  React__default.createElement(RootComponent, { onOpenChange: props.onOpenChange, open: props.open, defaultOpen: props.defaultOpen }, props.children)));
@@ -4303,4 +4303,4 @@ function mergeHiddenState(prevState, nextState) {
4303
4303
  return nextState;
4304
4304
  }
4305
4305
 
4306
- export { getElementAtPoint as A, findScrollableTouchTarget as B, useScrollAreaRootContext as C, DrawerTrigger as D, getOffset as E, ScrollAreaRootCssVars as F, scrollAreaStateAttributesMapping as G, useScrollAreaViewportContext as H, ScrollAreaRoot as S, DrawerRoot as a, DrawerPortal as b, DrawerBackdrop as c, DrawerViewport as d, DrawerPopup as e, ScrollAreaViewport as f, DrawerContent as g, useDialogPortalContext as h, DialogStore as i, DialogRoot as j, DialogTrigger as k, DialogPortal as l, DialogViewport as m, createInitialPopupStoreState as n, useDrawerProviderContext as o, popupStoreSelectors as p, DrawerBackdropCssVars as q, DrawerPopupCssVars as r, DrawerProviderContext as s, useDrawerRootContext as t, useDialogRootContext as u, useSwipeDismiss as v, getDisplacement as w, DrawerPopupDataAttributes as x, getElementTransform as y, DrawerVirtualKeyboardContext as z };
4306
+ export { getElementAtPoint as A, findScrollableTouchTarget as B, useScrollAreaRootContext as C, DrawerTrigger as D, getOffset as E, ScrollAreaRootCssVars as F, scrollAreaStateAttributesMapping as G, useScrollAreaViewportContext as H, ScrollAreaRoot as S, DrawerRoot as a, DrawerPortal as b, DrawerBackdrop as c, DrawerViewport as d, DrawerPopup as e, ScrollAreaViewport as f, DrawerContent as g, DialogRoot as h, DialogTrigger as i, DialogPortal as j, DialogViewport as k, useDialogPortalContext as l, DialogStore as m, createInitialPopupStoreState as n, useDrawerProviderContext as o, popupStoreSelectors as p, DrawerBackdropCssVars as q, DrawerPopupCssVars as r, DrawerProviderContext as s, useDrawerRootContext as t, useDialogRootContext as u, useSwipeDismiss as v, getDisplacement as w, DrawerPopupDataAttributes as x, getElementTransform as y, DrawerVirtualKeyboardContext as z };
@@ -140,7 +140,6 @@ function SelectDropdownRoot({ value, onValueChange, onBlur, onFocus, disabled, r
140
140
  React.createElement(SelectPrimitive.SelectPrimitive.List, null, children))))));
141
141
  }
142
142
 
143
- const SMALL_SCREEN_BREAKPOINT = jobberHooks.BREAKPOINT_SIZES.sm;
144
143
  const SelectShellContext = React.createContext(null);
145
144
  function useSelectShell() {
146
145
  const shell = React.useContext(SelectShellContext);
@@ -180,8 +179,7 @@ function Select({ label, description, error, invalid, value, onValueChange, onBl
180
179
  const isInvalid = hasError || Boolean(invalid);
181
180
  const showDescription = !inline && Boolean(description) && !hasError;
182
181
  const showError = !inline && hasError;
183
- const { width } = jobberHooks.useWindowDimensions();
184
- const isBottomSheet = width !== undefined && width <= SMALL_SCREEN_BREAKPOINT;
182
+ const isBottomSheet = jobberHooks.useIsSmallScreen();
185
183
  const shell = isBottomSheet ? selectBottomSheetShell : selectDropdownShell;
186
184
  const ShellRoot = isBottomSheet ? SelectBottomSheetRoot : SelectDropdownRoot;
187
185
  return (React.createElement(FieldDescription.FieldRoot, { className: classnames(styles.field, inline && styles.inline, size && styles[size], label && styles.hasLabel), disabled: disabled, invalid: isInvalid || undefined, name: name },
package/dist/Select-es.js CHANGED
@@ -1,5 +1,5 @@
1
1
  import React__default, { useState, useRef, useId, useImperativeHandle } from 'react';
2
- import { BREAKPOINT_SIZES, useWindowDimensions } from '@jobber/hooks';
2
+ import { useIsSmallScreen } from '@jobber/hooks';
3
3
  import classnames from 'classnames';
4
4
  import { S as SelectPrimitive } from './SelectPrimitive-es.js';
5
5
  import { a as BottomSheet } from './BottomSheet-es.js';
@@ -138,7 +138,6 @@ function SelectDropdownRoot({ value, onValueChange, onBlur, onFocus, disabled, r
138
138
  React__default.createElement(SelectPrimitive.List, null, children))))));
139
139
  }
140
140
 
141
- const SMALL_SCREEN_BREAKPOINT = BREAKPOINT_SIZES.sm;
142
141
  const SelectShellContext = React__default.createContext(null);
143
142
  function useSelectShell() {
144
143
  const shell = React__default.useContext(SelectShellContext);
@@ -178,8 +177,7 @@ function Select({ label, description, error, invalid, value, onValueChange, onBl
178
177
  const isInvalid = hasError || Boolean(invalid);
179
178
  const showDescription = !inline && Boolean(description) && !hasError;
180
179
  const showError = !inline && hasError;
181
- const { width } = useWindowDimensions();
182
- const isBottomSheet = width !== undefined && width <= SMALL_SCREEN_BREAKPOINT;
180
+ const isBottomSheet = useIsSmallScreen();
183
181
  const shell = isBottomSheet ? selectBottomSheetShell : selectDropdownShell;
184
182
  const ShellRoot = isBottomSheet ? SelectBottomSheetRoot : SelectDropdownRoot;
185
183
  return (React__default.createElement(FieldRoot, { className: classnames(styles.field, inline && styles.inline, size && styles[size], label && styles.hasLabel), disabled: disabled, invalid: isInvalid || undefined, name: name },
@@ -17,11 +17,6 @@ var DrawerTitle = require('./DrawerTitle-cjs.js');
17
17
  var DrawerDescription = require('./DrawerDescription-cjs.js');
18
18
  var nestedEscape = require('./nestedEscape-cjs.js');
19
19
 
20
- // Copied from Menu's constant so the two surfaces agree on what "mobile" means.
21
- // (The proposal calls for copying shared Menu values into the component first
22
- // and deciding later whether to promote them to a shared location.)
23
- const SMALL_SCREEN_BREAKPOINT = 490;
24
-
25
20
  var styles = {"small":"uYYyCR3l6E8-","base":"X1jGz-sLWf4-","large":"_4zFf2PkFhaA-","fullScreen":"nJoCr8oWJ7w-","header":"XFKiCQ8QbQU-","close":"FDOhnO0TT08-","scrollRegion":"_8DjYA23vHXA-","scrollViewport":"Bwr9IUYpLfM-","body":"zp9kx9uue2I-","fullBleed":"EhtwBTy1ai4-","footer":"DRIJhI1knKw-","sheetSurface":"vmcZRwOcNMo-","popup":"mFX7qDCd17I-","backdrop":"NE-BIsVE-hE-","viewport":"hp70o-3Cf-w-","spinning":"Zf-Z8DJcC-Y-"};
26
21
 
27
22
  var actionsStyles = {"actions":"hKVNddbxkmo-","leftActions":"nslrozOH-v4-","buttonGroup":"BrXAnQBttWE-","align-left":"_9Vgd-3YJxlI-","align-right":"_8HC9NqvmJdo-","align-fullWidth":"ZZ3XuxGv6ow-","spinning":"PWf7wHPhd2A-"};
@@ -323,8 +318,7 @@ function Dialog(_a) {
323
318
  }
324
319
  onOpenChange === null || onOpenChange === void 0 ? void 0 : onOpenChange(nextOpen, eventDetails);
325
320
  }
326
- const { width } = jobberHooks.useWindowDimensions();
327
- const isMobile = width !== undefined && width <= SMALL_SCREEN_BREAKPOINT;
321
+ const isMobile = jobberHooks.useIsSmallScreen();
328
322
  // The shell is the root component; its parts are reached via `useDialogShell`
329
323
  // in each part below (the Menu pattern).
330
324
  const RootComponent = isMobile ? DialogBottomSheet : DialogModal;
@@ -1,10 +1,10 @@
1
1
  import { _ as __rest } from './tslib.es6-es.js';
2
2
  import React__default, { isValidElement } from 'react';
3
- import { useWindowDimensions } from '@jobber/hooks';
3
+ import { useIsSmallScreen } from '@jobber/hooks';
4
4
  import classnames from 'classnames';
5
5
  import { n as normalizeBaseUiButtonProps, i as isAtlantisButtonRenderTarget, s as stripNativeTypeFromButtonRenderTarget, r as renderAtlantisButtonTarget } from './buttonRenderAdapter-es.js';
6
6
  import { B as Button } from './Button-es.js';
7
- import { S as ScrollAreaRoot, f as ScrollAreaViewport, g as DrawerContent, j as DialogRoot, k as DialogTrigger$1, l as DialogPortal, m as DialogViewport } from './ScrollAreaViewport-es.js';
7
+ import { S as ScrollAreaRoot, f as ScrollAreaViewport, g as DrawerContent, h as DialogRoot, i as DialogTrigger$1, j as DialogPortal, k as DialogViewport } from './ScrollAreaViewport-es.js';
8
8
  import { m as mergeProps } from './useRenderElement-es.js';
9
9
  import './OverlaySeparator-es.js';
10
10
  import { a as BottomSheet, B as BottomSheetScrollAreaContext } from './BottomSheet-es.js';
@@ -15,11 +15,6 @@ import { D as DrawerTitle, a as DrawerClose, b as DialogTitle$1, c as DialogClos
15
15
  import { D as DrawerDescription, a as DialogBackdrop, b as DialogPopup, c as DialogDescription, d as createDialogHandle } from './DrawerDescription-es.js';
16
16
  import { i as isEscapeHandledByModal } from './nestedEscape-es.js';
17
17
 
18
- // Copied from Menu's constant so the two surfaces agree on what "mobile" means.
19
- // (The proposal calls for copying shared Menu values into the component first
20
- // and deciding later whether to promote them to a shared location.)
21
- const SMALL_SCREEN_BREAKPOINT = 490;
22
-
23
18
  var styles = {"small":"uYYyCR3l6E8-","base":"X1jGz-sLWf4-","large":"_4zFf2PkFhaA-","fullScreen":"nJoCr8oWJ7w-","header":"XFKiCQ8QbQU-","close":"FDOhnO0TT08-","scrollRegion":"_8DjYA23vHXA-","scrollViewport":"Bwr9IUYpLfM-","body":"zp9kx9uue2I-","fullBleed":"EhtwBTy1ai4-","footer":"DRIJhI1knKw-","sheetSurface":"vmcZRwOcNMo-","popup":"mFX7qDCd17I-","backdrop":"NE-BIsVE-hE-","viewport":"hp70o-3Cf-w-","spinning":"Zf-Z8DJcC-Y-"};
24
19
 
25
20
  var actionsStyles = {"actions":"hKVNddbxkmo-","leftActions":"nslrozOH-v4-","buttonGroup":"BrXAnQBttWE-","align-left":"_9Vgd-3YJxlI-","align-right":"_8HC9NqvmJdo-","align-fullWidth":"ZZ3XuxGv6ow-","spinning":"PWf7wHPhd2A-"};
@@ -321,8 +316,7 @@ function Dialog(_a) {
321
316
  }
322
317
  onOpenChange === null || onOpenChange === void 0 ? void 0 : onOpenChange(nextOpen, eventDetails);
323
318
  }
324
- const { width } = useWindowDimensions();
325
- const isMobile = width !== undefined && width <= SMALL_SCREEN_BREAKPOINT;
319
+ const isMobile = useIsSmallScreen();
326
320
  // The shell is the root component; its parts are reached via `useDialogShell`
327
321
  // in each part below (the Menu pattern).
328
322
  const RootComponent = isMobile ? DialogBottomSheet : DialogModal;
@@ -6,7 +6,7 @@ import { bn as pointer, a as useIsoLayoutEffect, b as useStableCallback, C as Co
6
6
  import { S as Separator } from '../Separator-es.js';
7
7
  import { a as DialogBackdrop, c as DialogDescription, e as DialogHandle, b as DialogPopup, d as createDialogHandle, D as DrawerDescription } from '../DrawerDescription-es.js';
8
8
  import { c as DialogClose, b as DialogTitle, a as DrawerClose, D as DrawerTitle } from '../DrawerTitle-es.js';
9
- import { l as DialogPortal, j as DialogRoot, k as DialogTrigger, m as DialogViewport, o as useDrawerProviderContext, q as DrawerBackdropCssVars, r as DrawerPopupCssVars, s as DrawerProviderContext, u as useDialogRootContext, t as useDrawerRootContext, v as useSwipeDismiss, w as getDisplacement, x as DrawerPopupDataAttributes, y as getElementTransform, z as DrawerVirtualKeyboardContext, A as getElementAtPoint, B as findScrollableTouchTarget, c as DrawerBackdrop, g as DrawerContent, e as DrawerPopup, b as DrawerPortal, a as DrawerRoot, D as DrawerTrigger, d as DrawerViewport, C as useScrollAreaRootContext, E as getOffset, F as ScrollAreaRootCssVars, G as scrollAreaStateAttributesMapping, H as useScrollAreaViewportContext, S as ScrollAreaRoot, f as ScrollAreaViewport } from '../ScrollAreaViewport-es.js';
9
+ import { j as DialogPortal, h as DialogRoot, i as DialogTrigger, k as DialogViewport, o as useDrawerProviderContext, q as DrawerBackdropCssVars, r as DrawerPopupCssVars, s as DrawerProviderContext, u as useDialogRootContext, t as useDrawerRootContext, v as useSwipeDismiss, w as getDisplacement, x as DrawerPopupDataAttributes, y as getElementTransform, z as DrawerVirtualKeyboardContext, A as getElementAtPoint, B as findScrollableTouchTarget, c as DrawerBackdrop, g as DrawerContent, e as DrawerPopup, b as DrawerPortal, a as DrawerRoot, D as DrawerTrigger, d as DrawerViewport, C as useScrollAreaRootContext, E as getOffset, F as ScrollAreaRootCssVars, G as scrollAreaStateAttributesMapping, H as useScrollAreaViewportContext, S as ScrollAreaRoot, f as ScrollAreaViewport } from '../ScrollAreaViewport-es.js';
10
10
  import { u as useRenderElement, f as formatErrorMessage, N as NOOP, E as EMPTY_OBJECT } from '../useRenderElement-es.js';
11
11
  import { K as getWindow, h as getComputedStyle, i as isHTMLElement, e as getParentNode, G as round } from '../floating-ui.utils-es.js';
12
12
  import { c as clamp, g as getMaxScrollOffset, n as normalizeScrollOffset, S as SCROLL_EDGE_TOLERANCE_PX } from '../scrollEdges-es.js';
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@jobber/components",
3
- "version": "9.5.2",
3
+ "version": "9.5.3",
4
4
  "license": "MIT",
5
5
  "type": "module",
6
6
  "main": "dist/index.cjs",
@@ -491,7 +491,7 @@
491
491
  "@apollo/client": "^3.7.10",
492
492
  "@csstools/postcss-global-data": "^1.0.3",
493
493
  "@jobber/design": "0.111.0",
494
- "@jobber/hooks": "2.21.0",
494
+ "@jobber/hooks": "2.21.1",
495
495
  "@rollup/plugin-alias": "^5.1.0",
496
496
  "@rollup/plugin-commonjs": "^25.0.7",
497
497
  "@rollup/plugin-node-resolve": "15.2.3",
@@ -544,5 +544,5 @@
544
544
  "> 1%",
545
545
  "IE 10"
546
546
  ],
547
- "gitHead": "27628e1a709dd4ef497aaa1eb66b51dfd234bb46"
547
+ "gitHead": "2557e3892ae9903c706aebba90ff44bbb349618c"
548
548
  }
@@ -1 +0,0 @@
1
- export declare const SMALL_SCREEN_BREAKPOINT = 490;