@jobber/components 6.82.6 → 6.84.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.
@@ -2,7 +2,7 @@ import type { ChipProps } from "../Chip";
2
2
  import type { ChipDismissibleProps } from "../ChipsTypes";
3
3
  export type InternalChipDismissibleProps = Omit<ChipDismissibleProps, "type">;
4
4
  export interface ChipDismissibleInputProps extends Pick<InternalChipDismissibleProps, "activator" | "isLoadingMore" | "onSearch" | "onLoadMore"> {
5
- readonly attachTo: React.RefObject<Element | null>;
5
+ readonly attachTo: HTMLElement | null;
6
6
  readonly options: ChipProps[];
7
7
  onCustomOptionSelect?(value: string): void;
8
8
  onOptionSelect(value: string): void;
@@ -17,7 +17,9 @@ require('../../../_setToString-cjs.js');
17
17
  require('../../../debounce-cjs.js');
18
18
  require('../../../Icon-cjs.js');
19
19
  require('@jobber/design');
20
- require('react-popper');
20
+ require('../../../floating-ui.react-cjs.js');
21
+ require('react-dom');
22
+ require('../../../maxHeight-cjs.js');
21
23
 
22
24
 
23
25
 
@@ -15,4 +15,6 @@ import '../../../_setToString-es.js';
15
15
  import '../../../debounce-es.js';
16
16
  import '../../../Icon-es.js';
17
17
  import '@jobber/design';
18
- import 'react-popper';
18
+ import '../../../floating-ui.react-es.js';
19
+ import 'react-dom';
20
+ import '../../../maxHeight-es.js';
@@ -1,7 +1,8 @@
1
1
  import type { KeyboardEvent, MouseEvent } from "react";
2
2
  import type { InternalChipDismissibleProps } from "../InternalChipDismissibleTypes";
3
3
  export declare function useInternalChipDismissible({ children, selected, onChange, onClick, onCustomAdd, }: InternalChipDismissibleProps): {
4
- ref: import("react").RefObject<HTMLDivElement>;
4
+ ref: import("react").Dispatch<import("react").SetStateAction<HTMLDivElement | null>>;
5
+ wrapperElement: HTMLDivElement | null;
5
6
  sortedVisibleChipOptions: import("../../Chip").ChipProps[];
6
7
  availableChipOptions: import("../../Chip").ChipProps[];
7
8
  handleChipRemove: (value: string) => () => void;
@@ -1,16 +1,7 @@
1
- import type { RefObject } from "react";
2
- export declare function useRepositionMenu(attachTo: RefObject<Element | null>): {
3
- setPositionedElementRef: import("react").Dispatch<import("react").SetStateAction<HTMLElement | null | undefined>>;
4
- targetWidth: number | undefined;
5
- styles: {
6
- [key: string]: React.CSSProperties;
1
+ export interface UseRepositionMenu {
2
+ readonly setFloatingRef: (ref: HTMLElement | null) => void;
3
+ readonly styles: {
4
+ float: React.CSSProperties;
7
5
  };
8
- attributes: {
9
- [key: string]: {
10
- [key: string]: string;
11
- } | undefined;
12
- };
13
- state: import("@popperjs/core").State | null;
14
- update: import("@popperjs/core").Instance["update"] | null;
15
- forceUpdate: import("@popperjs/core").Instance["forceUpdate"] | null;
16
- };
6
+ }
7
+ export declare function useRepositionMenu(attachTo: HTMLElement | null): UseRepositionMenu;
@@ -1 +1 @@
1
- export declare function useScrollToActive(index: number): import("react").RefObject<HTMLDivElement>;
1
+ export declare function useScrollToActive(index: number): import("react").MutableRefObject<HTMLDivElement | null>;
@@ -18,9 +18,10 @@ require('../../_setToString-cjs.js');
18
18
  require('../../debounce-cjs.js');
19
19
  require('../../Icon-cjs.js');
20
20
  require('@jobber/design');
21
- require('react-popper');
21
+ require('../../floating-ui.react-cjs.js');
22
+ require('react-dom');
23
+ require('../../maxHeight-cjs.js');
22
24
  require('classnames');
23
- require('../../useSafeLayoutEffect-cjs.js');
24
25
  require('../../Text-cjs.js');
25
26
  require('../../Typography-cjs.js');
26
27
  require('../../Button-cjs.js');
@@ -33,9 +34,8 @@ require('../../Avatar-cjs.js');
33
34
  require('color');
34
35
  require('../../useChildComponent-cjs.js');
35
36
  require('../../Tooltip-cjs.js');
36
- require('../../floating-ui.react-cjs.js');
37
- require('react-dom');
38
37
  require('framer-motion');
38
+ require('../../useSafeLayoutEffect-cjs.js');
39
39
  require('../../useIsMounted-cjs.js');
40
40
 
41
41
 
@@ -16,9 +16,10 @@ import '../../_setToString-es.js';
16
16
  import '../../debounce-es.js';
17
17
  import '../../Icon-es.js';
18
18
  import '@jobber/design';
19
- import 'react-popper';
19
+ import '../../floating-ui.react-es.js';
20
+ import 'react-dom';
21
+ import '../../maxHeight-es.js';
20
22
  import 'classnames';
21
- import '../../useSafeLayoutEffect-es.js';
22
23
  import '../../Text-es.js';
23
24
  import '../../Typography-es.js';
24
25
  import '../../Button-es.js';
@@ -31,7 +32,6 @@ import '../../Avatar-es.js';
31
32
  import 'color';
32
33
  import '../../useChildComponent-es.js';
33
34
  import '../../Tooltip-es.js';
34
- import '../../floating-ui.react-es.js';
35
- import 'react-dom';
36
35
  import 'framer-motion';
36
+ import '../../useSafeLayoutEffect-es.js';
37
37
  import '../../useIsMounted-es.js';
@@ -20,9 +20,10 @@ require('../_setToString-cjs.js');
20
20
  require('../debounce-cjs.js');
21
21
  require('../Icon-cjs.js');
22
22
  require('@jobber/design');
23
- require('react-popper');
23
+ require('../floating-ui.react-cjs.js');
24
+ require('react-dom');
25
+ require('../maxHeight-cjs.js');
24
26
  require('classnames');
25
- require('../useSafeLayoutEffect-cjs.js');
26
27
  require('../Text-cjs.js');
27
28
  require('../Typography-cjs.js');
28
29
  require('../Button-cjs.js');
@@ -34,9 +35,8 @@ require('../Avatar-cjs.js');
34
35
  require('color');
35
36
  require('../useChildComponent-cjs.js');
36
37
  require('../Tooltip-cjs.js');
37
- require('../floating-ui.react-cjs.js');
38
- require('react-dom');
39
38
  require('framer-motion');
39
+ require('../useSafeLayoutEffect-cjs.js');
40
40
  require('../useIsMounted-cjs.js');
41
41
 
42
42
  function ChipDismissible({ label, disabled, invalid, prefix, onClick, onRequestRemove, }) {
@@ -18,9 +18,10 @@ import '../_setToString-es.js';
18
18
  import '../debounce-es.js';
19
19
  import '../Icon-es.js';
20
20
  import '@jobber/design';
21
- import 'react-popper';
21
+ import '../floating-ui.react-es.js';
22
+ import 'react-dom';
23
+ import '../maxHeight-es.js';
22
24
  import 'classnames';
23
- import '../useSafeLayoutEffect-es.js';
24
25
  import '../Text-es.js';
25
26
  import '../Typography-es.js';
26
27
  import '../Button-es.js';
@@ -32,9 +33,8 @@ import '../Avatar-es.js';
32
33
  import 'color';
33
34
  import '../useChildComponent-es.js';
34
35
  import '../Tooltip-es.js';
35
- import '../floating-ui.react-es.js';
36
- import 'react-dom';
37
36
  import 'framer-motion';
37
+ import '../useSafeLayoutEffect-es.js';
38
38
  import '../useIsMounted-es.js';
39
39
 
40
40
  function ChipDismissible({ label, disabled, invalid, prefix, onClick, onRequestRemove, }) {
@@ -2,6 +2,7 @@ import React from "react";
2
2
  interface FormFieldPostFixProps {
3
3
  readonly variation: "select" | "spinner";
4
4
  readonly visible?: boolean;
5
+ readonly className?: string;
5
6
  }
6
- export declare function FormFieldPostFix({ variation, visible, }: FormFieldPostFixProps): React.JSX.Element | null;
7
+ export declare function FormFieldPostFix({ variation, visible, className, }: FormFieldPostFixProps): React.JSX.Element | null;
7
8
  export {};
@@ -252,10 +252,10 @@ function FormFieldWrapperToolbar({ toolbar, isToolbarVisible, toolbarAnimationEn
252
252
  React.createElement("div", { className: styles$1.toolbar, "data-testid": "ATL-InputText-Toolbar" }, toolbar)))));
253
253
  }
254
254
 
255
- function FormFieldPostFix({ variation, visible = true, }) {
255
+ function FormFieldPostFix({ variation, visible = true, className, }) {
256
256
  if (!visible)
257
257
  return null;
258
- return (React.createElement("span", { className: styles$1.postfix }, variation === "select" ? (React.createElement(Icon.Icon, { name: "arrowDown" })) : (React.createElement(Spinner.Spinner, { size: "small" }))));
258
+ return (React.createElement("span", { className: classnames(styles$1.postfix, className) }, variation === "select" ? (React.createElement(Icon.Icon, { name: "arrowDown" })) : (React.createElement(Spinner.Spinner, { size: "small" }))));
259
259
  }
260
260
 
261
261
  /**
@@ -250,10 +250,10 @@ function FormFieldWrapperToolbar({ toolbar, isToolbarVisible, toolbarAnimationEn
250
250
  React__default.createElement("div", { className: styles$1.toolbar, "data-testid": "ATL-InputText-Toolbar" }, toolbar)))));
251
251
  }
252
252
 
253
- function FormFieldPostFix({ variation, visible = true, }) {
253
+ function FormFieldPostFix({ variation, visible = true, className, }) {
254
254
  if (!visible)
255
255
  return null;
256
- return (React__default.createElement("span", { className: styles$1.postfix }, variation === "select" ? (React__default.createElement(Icon, { name: "arrowDown" })) : (React__default.createElement(Spinner, { size: "small" }))));
256
+ return (React__default.createElement("span", { className: classnames(styles$1.postfix, className) }, variation === "select" ? (React__default.createElement(Icon, { name: "arrowDown" })) : (React__default.createElement(Spinner, { size: "small" }))));
257
257
  }
258
258
 
259
259
  /**
@@ -4,8 +4,8 @@ var React = require('react');
4
4
  var tslib_es6 = require('../tslib.es6-cjs.js');
5
5
  var debounce = require('../debounce-cjs.js');
6
6
  var FormField = require('../FormField-cjs.js');
7
- require('@jobber/design');
8
7
  require('classnames');
8
+ require('@jobber/design');
9
9
  require('react-hook-form');
10
10
  require('../Button-cjs.js');
11
11
  var omit = require('../omit-cjs.js');
@@ -2,8 +2,8 @@ import React__default, { useState, useCallback, useEffect, useRef, useId } from
2
2
  import { _ as __rest } from '../tslib.es6-es.js';
3
3
  import { a as debounce } from '../debounce-es.js';
4
4
  import { j as useFormFieldWrapperStyles, f as FormFieldWrapper, k as FormField } from '../FormField-es.js';
5
- import '@jobber/design';
6
5
  import 'classnames';
6
+ import '@jobber/design';
7
7
  import 'react-hook-form';
8
8
  import '../Button-es.js';
9
9
  import { o as omit } from '../omit-es.js';
@@ -4,9 +4,8 @@ var React = require('react');
4
4
  var useScrollToActive = require('./useScrollToActive-cjs.js');
5
5
  require('./isObjectLike-cjs.js');
6
6
  require('@jobber/design');
7
- require('react-popper');
8
7
  var classnames = require('classnames');
9
- var useSafeLayoutEffect = require('./useSafeLayoutEffect-cjs.js');
8
+ var floatingUi_react = require('./floating-ui.react-cjs.js');
10
9
  var Text = require('./Text-cjs.js');
11
10
  var Button = require('./Button-cjs.js');
12
11
  var Spinner = require('./Spinner-cjs.js');
@@ -19,17 +18,14 @@ function InternalChip({ label, active = false, disabled = false, invalid = false
19
18
  suffix && React.createElement(Chip.ChipNamespace.Suffix, null, suffix)));
20
19
  }
21
20
 
22
- var styles = {"wrapper":"XRnU90M2-fs-","input":"Dq-yFHd1zK0-","menu":"F7CpurjKzBI-","menuList":"J8USVG1tjPs-","menuListOption":"_9SAK31TqNDY-","loadingIndicator":"s5vFJVv0t0Q-","activeOption":"_8d0w-JzgzS4-","spinning":"hDJGLX6kE-U-"};
21
+ var styles = {"wrapper":"XRnU90M2-fs-","input":"Dq-yFHd1zK0-","menu":"F7CpurjKzBI-","menuListOption":"_9SAK31TqNDY-","loadingIndicator":"s5vFJVv0t0Q-","activeOption":"_8d0w-JzgzS4-","spinning":"hDJGLX6kE-U-"};
23
22
 
24
23
  function InternalChipDismissibleInput(props) {
25
24
  const { activator = React.createElement(Button.Button, { icon: "add", type: "secondary", ariaLabel: "Add" }), attachTo, isLoadingMore = false, onLoadMore, options, } = props;
26
25
  const { activeIndex, allOptions, hasAvailableOptions, inputRef, menuId, menuOpen, searchValue, showInput, generateDescendantId, handleBlur, handleFocus, handleSearchChange, handleCancelBlur, handleEnableBlur, handleSetActiveOnMouseOver, handleKeyDown, handleSelectOption, handleShowInput, handleDebouncedSearch, } = useScrollToActive.useInternalChipDismissibleInput(props);
27
- const menuRef = useScrollToActive.useScrollToActive(activeIndex);
26
+ const scrollableRef = useScrollToActive.useScrollToActive(activeIndex);
28
27
  const { ref: visibleChildRef, isInView } = useScrollToActive.useInView();
29
- const { styles: popperStyles, attributes, update, setPositionedElementRef, } = useScrollToActive.useRepositionMenu(attachTo);
30
- useSafeLayoutEffect.useSafeLayoutEffect_1(() => {
31
- update === null || update === void 0 ? void 0 : update();
32
- }, [allOptions, menuOpen, update, options]);
28
+ const { styles: floatingStyles, setFloatingRef } = useScrollToActive.useRepositionMenu(attachTo);
33
29
  React.useEffect(() => {
34
30
  handleDebouncedSearch(searchValue, options);
35
31
  return handleDebouncedSearch.cancel;
@@ -41,25 +37,28 @@ function InternalChipDismissibleInput(props) {
41
37
  return React.cloneElement(activator, { onClick: handleShowInput });
42
38
  }
43
39
  const shouldShowMenu = menuOpen && (hasAvailableOptions || isLoadingMore);
40
+ const menuContent = (React.createElement("div", { ref: node => {
41
+ setFloatingRef(node);
42
+ scrollableRef.current = node;
43
+ }, role: "listbox", id: menuId, className: styles.menu, style: floatingStyles.float, "data-testid": "chip-menu" },
44
+ allOptions.map((option, i) => (React.createElement("button", { key: option.value, role: "option", type: "button", id: generateDescendantId(i), className: classnames(styles.menuListOption, {
45
+ [styles.activeOption]: activeIndex === i,
46
+ }), onClick: () => handleSelectOption(option), onMouseEnter: handleSetActiveOnMouseOver(i), onMouseDown: handleCancelBlur, onMouseUp: handleEnableBlur },
47
+ React.createElement("span", { "aria-hidden": true }, option.prefix),
48
+ React.createElement(Text.Text, null, option.label)))),
49
+ React.createElement("div", { ref: visibleChildRef }),
50
+ isLoadingMore && (React.createElement("div", { className: styles.loadingIndicator },
51
+ React.createElement(Spinner.Spinner, { size: "small", inline: true })))));
44
52
  return (React.createElement(React.Fragment, null,
45
53
  React.createElement("input", { ref: inputRef, className: styles.input, type: "text", role: "combobox", "aria-label": "Press up and down arrow to cycle through the options or type to narrow down the results", "aria-autocomplete": "list", "aria-owns": menuId, "aria-expanded": shouldShowMenu, "aria-activedescendant": generateDescendantId(activeIndex), value: searchValue, onChange: handleSearchChange, onKeyDown: handleKeyDown, onBlur: () => setTimeout(handleBlur, 200), onFocus: handleFocus, autoFocus: true }),
46
- shouldShowMenu && (React.createElement("div", Object.assign({ ref: setPositionedElementRef, className: styles.menu, style: popperStyles.popper }, attributes.popper),
47
- React.createElement("div", { ref: menuRef, role: "listbox", id: menuId, className: styles.menuList, "data-testid": "chip-menu" },
48
- allOptions.map((option, i) => (React.createElement("button", { key: option.value, role: "option", type: "button", id: generateDescendantId(i), className: classnames(styles.menuListOption, {
49
- [styles.activeOption]: activeIndex === i,
50
- }), onClick: () => handleSelectOption(option), onMouseEnter: handleSetActiveOnMouseOver(i), onMouseDown: handleCancelBlur, onMouseUp: handleEnableBlur },
51
- React.createElement("span", { "aria-hidden": true }, option.prefix),
52
- React.createElement(Text.Text, null, option.label)))),
53
- React.createElement("div", { ref: visibleChildRef }),
54
- isLoadingMore && (React.createElement("div", { className: styles.loadingIndicator },
55
- React.createElement(Spinner.Spinner, { size: "small", inline: true }))))))));
54
+ shouldShowMenu && React.createElement(floatingUi_react.FloatingPortal, null, menuContent)));
56
55
  }
57
56
 
58
57
  function InternalChipDismissible(props) {
59
- const { availableChipOptions, ref: wrapperRef, sortedVisibleChipOptions, handleChipAdd, handleChipClick, handleChipKeyDown, handleChipRemove, handleCustomAdd, handleWrapperKeyDown, } = useScrollToActive.useInternalChipDismissible(props);
58
+ const { availableChipOptions, ref: wrapperRef, wrapperElement, sortedVisibleChipOptions, handleChipAdd, handleChipClick, handleChipKeyDown, handleChipRemove, handleCustomAdd, handleWrapperKeyDown, } = useScrollToActive.useInternalChipDismissible(props);
60
59
  return (React.createElement("div", { ref: wrapperRef, className: styles.wrapper, "data-testid": "dismissible-chips", onKeyDown: handleWrapperKeyDown, role: "listbox" },
61
60
  sortedVisibleChipOptions.map(chip => (React.createElement(InternalChip, Object.assign({ key: chip.value }, chip, { onKeyDown: handleChipKeyDown(chip.value), onClick: handleChipClick(chip.value), ariaLabel: `${chip.label}. Press delete or backspace to remove ${chip.label}`, tabIndex: 0, suffix: React.createElement(Chip.InternalChipButton, { icon: "remove", invalid: chip.invalid, disabled: chip.disabled, label: chip.label, onClick: handleChipRemove(chip.value) }) })))),
62
- React.createElement(InternalChipDismissibleInput, { activator: props.activator, attachTo: wrapperRef, isLoadingMore: props.isLoadingMore, options: availableChipOptions, onOptionSelect: handleChipAdd, onCustomOptionSelect: handleCustomAdd, onSearch: props.onSearch, onLoadMore: props.onLoadMore, onlyShowMenuOnSearch: props.onlyShowMenuOnSearch, autoSelectOnClickOutside: props.autoSelectOnClickOutside })));
61
+ React.createElement(InternalChipDismissibleInput, { activator: props.activator, attachTo: wrapperElement, isLoadingMore: props.isLoadingMore, options: availableChipOptions, onOptionSelect: handleChipAdd, onCustomOptionSelect: handleCustomAdd, onSearch: props.onSearch, onLoadMore: props.onLoadMore, onlyShowMenuOnSearch: props.onlyShowMenuOnSearch, autoSelectOnClickOutside: props.autoSelectOnClickOutside })));
63
62
  }
64
63
 
65
64
  exports.InternalChip = InternalChip;
@@ -2,9 +2,8 @@ import React__default, { useEffect } from 'react';
2
2
  import { a as useInternalChipDismissibleInput, d as useScrollToActive, b as useInView, c as useRepositionMenu, u as useInternalChipDismissible } from './useScrollToActive-es.js';
3
3
  import './isObjectLike-es.js';
4
4
  import '@jobber/design';
5
- import 'react-popper';
6
5
  import classnames from 'classnames';
7
- import { u as useSafeLayoutEffect_1 } from './useSafeLayoutEffect-es.js';
6
+ import { F as FloatingPortal } from './floating-ui.react-es.js';
8
7
  import { T as Text } from './Text-es.js';
9
8
  import { B as Button } from './Button-es.js';
10
9
  import { S as Spinner } from './Spinner-es.js';
@@ -17,17 +16,14 @@ function InternalChip({ label, active = false, disabled = false, invalid = false
17
16
  suffix && React__default.createElement(ChipNamespace.Suffix, null, suffix)));
18
17
  }
19
18
 
20
- var styles = {"wrapper":"XRnU90M2-fs-","input":"Dq-yFHd1zK0-","menu":"F7CpurjKzBI-","menuList":"J8USVG1tjPs-","menuListOption":"_9SAK31TqNDY-","loadingIndicator":"s5vFJVv0t0Q-","activeOption":"_8d0w-JzgzS4-","spinning":"hDJGLX6kE-U-"};
19
+ var styles = {"wrapper":"XRnU90M2-fs-","input":"Dq-yFHd1zK0-","menu":"F7CpurjKzBI-","menuListOption":"_9SAK31TqNDY-","loadingIndicator":"s5vFJVv0t0Q-","activeOption":"_8d0w-JzgzS4-","spinning":"hDJGLX6kE-U-"};
21
20
 
22
21
  function InternalChipDismissibleInput(props) {
23
22
  const { activator = React__default.createElement(Button, { icon: "add", type: "secondary", ariaLabel: "Add" }), attachTo, isLoadingMore = false, onLoadMore, options, } = props;
24
23
  const { activeIndex, allOptions, hasAvailableOptions, inputRef, menuId, menuOpen, searchValue, showInput, generateDescendantId, handleBlur, handleFocus, handleSearchChange, handleCancelBlur, handleEnableBlur, handleSetActiveOnMouseOver, handleKeyDown, handleSelectOption, handleShowInput, handleDebouncedSearch, } = useInternalChipDismissibleInput(props);
25
- const menuRef = useScrollToActive(activeIndex);
24
+ const scrollableRef = useScrollToActive(activeIndex);
26
25
  const { ref: visibleChildRef, isInView } = useInView();
27
- const { styles: popperStyles, attributes, update, setPositionedElementRef, } = useRepositionMenu(attachTo);
28
- useSafeLayoutEffect_1(() => {
29
- update === null || update === void 0 ? void 0 : update();
30
- }, [allOptions, menuOpen, update, options]);
26
+ const { styles: floatingStyles, setFloatingRef } = useRepositionMenu(attachTo);
31
27
  useEffect(() => {
32
28
  handleDebouncedSearch(searchValue, options);
33
29
  return handleDebouncedSearch.cancel;
@@ -39,25 +35,28 @@ function InternalChipDismissibleInput(props) {
39
35
  return React__default.cloneElement(activator, { onClick: handleShowInput });
40
36
  }
41
37
  const shouldShowMenu = menuOpen && (hasAvailableOptions || isLoadingMore);
38
+ const menuContent = (React__default.createElement("div", { ref: node => {
39
+ setFloatingRef(node);
40
+ scrollableRef.current = node;
41
+ }, role: "listbox", id: menuId, className: styles.menu, style: floatingStyles.float, "data-testid": "chip-menu" },
42
+ allOptions.map((option, i) => (React__default.createElement("button", { key: option.value, role: "option", type: "button", id: generateDescendantId(i), className: classnames(styles.menuListOption, {
43
+ [styles.activeOption]: activeIndex === i,
44
+ }), onClick: () => handleSelectOption(option), onMouseEnter: handleSetActiveOnMouseOver(i), onMouseDown: handleCancelBlur, onMouseUp: handleEnableBlur },
45
+ React__default.createElement("span", { "aria-hidden": true }, option.prefix),
46
+ React__default.createElement(Text, null, option.label)))),
47
+ React__default.createElement("div", { ref: visibleChildRef }),
48
+ isLoadingMore && (React__default.createElement("div", { className: styles.loadingIndicator },
49
+ React__default.createElement(Spinner, { size: "small", inline: true })))));
42
50
  return (React__default.createElement(React__default.Fragment, null,
43
51
  React__default.createElement("input", { ref: inputRef, className: styles.input, type: "text", role: "combobox", "aria-label": "Press up and down arrow to cycle through the options or type to narrow down the results", "aria-autocomplete": "list", "aria-owns": menuId, "aria-expanded": shouldShowMenu, "aria-activedescendant": generateDescendantId(activeIndex), value: searchValue, onChange: handleSearchChange, onKeyDown: handleKeyDown, onBlur: () => setTimeout(handleBlur, 200), onFocus: handleFocus, autoFocus: true }),
44
- shouldShowMenu && (React__default.createElement("div", Object.assign({ ref: setPositionedElementRef, className: styles.menu, style: popperStyles.popper }, attributes.popper),
45
- React__default.createElement("div", { ref: menuRef, role: "listbox", id: menuId, className: styles.menuList, "data-testid": "chip-menu" },
46
- allOptions.map((option, i) => (React__default.createElement("button", { key: option.value, role: "option", type: "button", id: generateDescendantId(i), className: classnames(styles.menuListOption, {
47
- [styles.activeOption]: activeIndex === i,
48
- }), onClick: () => handleSelectOption(option), onMouseEnter: handleSetActiveOnMouseOver(i), onMouseDown: handleCancelBlur, onMouseUp: handleEnableBlur },
49
- React__default.createElement("span", { "aria-hidden": true }, option.prefix),
50
- React__default.createElement(Text, null, option.label)))),
51
- React__default.createElement("div", { ref: visibleChildRef }),
52
- isLoadingMore && (React__default.createElement("div", { className: styles.loadingIndicator },
53
- React__default.createElement(Spinner, { size: "small", inline: true }))))))));
52
+ shouldShowMenu && React__default.createElement(FloatingPortal, null, menuContent)));
54
53
  }
55
54
 
56
55
  function InternalChipDismissible(props) {
57
- const { availableChipOptions, ref: wrapperRef, sortedVisibleChipOptions, handleChipAdd, handleChipClick, handleChipKeyDown, handleChipRemove, handleCustomAdd, handleWrapperKeyDown, } = useInternalChipDismissible(props);
56
+ const { availableChipOptions, ref: wrapperRef, wrapperElement, sortedVisibleChipOptions, handleChipAdd, handleChipClick, handleChipKeyDown, handleChipRemove, handleCustomAdd, handleWrapperKeyDown, } = useInternalChipDismissible(props);
58
57
  return (React__default.createElement("div", { ref: wrapperRef, className: styles.wrapper, "data-testid": "dismissible-chips", onKeyDown: handleWrapperKeyDown, role: "listbox" },
59
58
  sortedVisibleChipOptions.map(chip => (React__default.createElement(InternalChip, Object.assign({ key: chip.value }, chip, { onKeyDown: handleChipKeyDown(chip.value), onClick: handleChipClick(chip.value), ariaLabel: `${chip.label}. Press delete or backspace to remove ${chip.label}`, tabIndex: 0, suffix: React__default.createElement(InternalChipButton, { icon: "remove", invalid: chip.invalid, disabled: chip.disabled, label: chip.label, onClick: handleChipRemove(chip.value) }) })))),
60
- React__default.createElement(InternalChipDismissibleInput, { activator: props.activator, attachTo: wrapperRef, isLoadingMore: props.isLoadingMore, options: availableChipOptions, onOptionSelect: handleChipAdd, onCustomOptionSelect: handleCustomAdd, onSearch: props.onSearch, onLoadMore: props.onLoadMore, onlyShowMenuOnSearch: props.onlyShowMenuOnSearch, autoSelectOnClickOutside: props.autoSelectOnClickOutside })));
59
+ React__default.createElement(InternalChipDismissibleInput, { activator: props.activator, attachTo: wrapperElement, isLoadingMore: props.isLoadingMore, options: availableChipOptions, onOptionSelect: handleChipAdd, onCustomOptionSelect: handleCustomAdd, onSearch: props.onSearch, onLoadMore: props.onLoadMore, onlyShowMenuOnSearch: props.onlyShowMenuOnSearch, autoSelectOnClickOutside: props.autoSelectOnClickOutside })));
61
60
  }
62
61
 
63
62
  export { InternalChipDismissible as I, InternalChip as a };
@@ -0,0 +1,29 @@
1
+ import React from "react";
2
+ import type { ReactNode } from "react";
3
+ export interface OptionGroupProps {
4
+ readonly children?: ReactNode;
5
+ readonly label: string;
6
+ readonly disabled?: boolean;
7
+ /**
8
+ * Use at your own risk: Custom classnames for specific elements. This should only be used as a
9
+ * last resort. Using this may result in unexpected side effects.
10
+ * More information in the [Customizing components Guide](https://atlantis.getjobber.com/guides/customizing-components).
11
+ *
12
+ * Additional details: The provided class names are applied to the root `<optgroup>` element.
13
+ * Only effective when `Select` version={2} is used with `UNSAFE_experimentalStyles`.
14
+ */
15
+ readonly UNSAFE_className?: string;
16
+ /**
17
+ * Use at your own risk: Custom style 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
+ * Additional details: Styles are applied directly to the root `<optgroup>` element via
22
+ * `UNSAFE_style.container`. Only effective when `Select` version={2} is used with
23
+ * `UNSAFE_experimentalStyles`.
24
+ */
25
+ readonly UNSAFE_style?: {
26
+ container?: React.CSSProperties;
27
+ };
28
+ }
29
+ export declare function OptionGroup({ children, label, disabled, UNSAFE_className, UNSAFE_style, }: OptionGroupProps): React.JSX.Element;
@@ -14,4 +14,11 @@ export interface SelectRebuiltProps extends Omit<SelectLegacyProps, "defaultValu
14
14
  onChange?(newValue?: string | number): void;
15
15
  version: 2;
16
16
  error?: string;
17
+ /**
18
+ * Opt-in to the customizable select UI (Chromium 123+).
19
+ * When true, the component will apply the custom select styles
20
+ * Defaults to false for native behavior.
21
+ * Only supported by Select version={2}.
22
+ */
23
+ readonly UNSAFE_experimentalStyles?: boolean;
17
24
  }
@@ -3,7 +3,7 @@
3
3
  var React = require('react');
4
4
  var omit = require('../omit-cjs.js');
5
5
  var FormField = require('../FormField-cjs.js');
6
- require('classnames');
6
+ var classnames = require('classnames');
7
7
  require('../tslib.es6-cjs.js');
8
8
  require('react-hook-form');
9
9
  require('framer-motion');
@@ -67,6 +67,8 @@ function useSelectFormField({ id, name, disabled, autofocus, description, inline
67
67
  return { fieldProps, descriptionIdentifier };
68
68
  }
69
69
 
70
+ var styles = {"select":"-hmXAsAfH9U-","selectPostfix":"_5ST4c1fXDYU-","spinning":"oOACJmrVDf0-"};
71
+
70
72
  function SelectRebuilt(props) {
71
73
  var _a, _b;
72
74
  const selectRef = (_a = props.inputRef) !== null && _a !== void 0 ? _a : React.useRef(null);
@@ -97,8 +99,8 @@ function SelectRebuilt(props) {
97
99
  handleFocus }));
98
100
  return (React.createElement(FormField.FormFieldWrapper, { disabled: props.disabled, size: props.size, align: props.align, inline: props.inline, autofocus: props.autofocus, name: name, wrapperRef: wrapperRef, error: (_b = props.error) !== null && _b !== void 0 ? _b : "", invalid: props.invalid, identifier: id, descriptionIdentifier: descriptionIdentifier, description: props.description, type: "select", placeholder: props.placeholder, value: props.value, prefix: props.prefix, suffix: props.suffix, clearable: "never", maxLength: props.maxLength },
99
101
  React.createElement(React.Fragment, null,
100
- React.createElement("select", Object.assign({}, fieldProps, { ref: selectRef, className: inputStyle }), props.children),
101
- React.createElement(FormField.FormFieldPostFix, { variation: "select" }))));
102
+ React.createElement("select", Object.assign({}, fieldProps, { ref: selectRef, className: classnames(inputStyle, props.UNSAFE_experimentalStyles && styles.select) }), props.children),
103
+ React.createElement(FormField.FormFieldPostFix, { variation: "select", className: styles.selectPostfix }))));
102
104
  }
103
105
  function useSelectId(props) {
104
106
  const generatedId = React.useId();
@@ -109,6 +111,10 @@ function SelectOption({ children, disabled, value }) {
109
111
  return (React.createElement("option", { disabled: disabled, value: value }, children));
110
112
  }
111
113
 
114
+ function OptionGroup({ children, label, disabled, UNSAFE_className, UNSAFE_style, }) {
115
+ return (React.createElement("optgroup", { label: label, disabled: disabled, className: UNSAFE_className, style: UNSAFE_style === null || UNSAFE_style === void 0 ? void 0 : UNSAFE_style.container }, children));
116
+ }
117
+
112
118
  function isNewSelectProps(props) {
113
119
  return props.version === 2;
114
120
  }
@@ -120,6 +126,8 @@ function Select(props) {
120
126
  return React.createElement(Select$1, Object.assign({}, props));
121
127
  }
122
128
  }
129
+ Select.Option = SelectOption;
130
+ Select.OptionGroup = OptionGroup;
123
131
 
124
132
  exports.Option = SelectOption;
125
133
  exports.Select = Select;
@@ -3,4 +3,8 @@ import { type SelectLegacyProps, type SelectRebuiltProps } from "./Select.types"
3
3
  export { Option } from "./Option";
4
4
  export type SelectShimProps = SelectLegacyProps | SelectRebuiltProps;
5
5
  export declare function Select(props: SelectShimProps): React.JSX.Element;
6
+ export declare namespace Select {
7
+ var Option: typeof import("./Option").Option;
8
+ var OptionGroup: typeof import("./OptionGroup").OptionGroup;
9
+ }
6
10
  export type { SelectRebuiltProps, SelectLegacyProps };
@@ -1,7 +1,7 @@
1
1
  import React__default, { useRef, useId } from 'react';
2
2
  import { o as omit } from '../omit-es.js';
3
3
  import { k as FormField, j as useFormFieldWrapperStyles, b as useAtlantisFormFieldName, f as FormFieldWrapper, l as FormFieldPostFix } from '../FormField-es.js';
4
- import 'classnames';
4
+ import classnames from 'classnames';
5
5
  import '../tslib.es6-es.js';
6
6
  import 'react-hook-form';
7
7
  import 'framer-motion';
@@ -65,6 +65,8 @@ function useSelectFormField({ id, name, disabled, autofocus, description, inline
65
65
  return { fieldProps, descriptionIdentifier };
66
66
  }
67
67
 
68
+ var styles = {"select":"-hmXAsAfH9U-","selectPostfix":"_5ST4c1fXDYU-","spinning":"oOACJmrVDf0-"};
69
+
68
70
  function SelectRebuilt(props) {
69
71
  var _a, _b;
70
72
  const selectRef = (_a = props.inputRef) !== null && _a !== void 0 ? _a : useRef(null);
@@ -95,8 +97,8 @@ function SelectRebuilt(props) {
95
97
  handleFocus }));
96
98
  return (React__default.createElement(FormFieldWrapper, { disabled: props.disabled, size: props.size, align: props.align, inline: props.inline, autofocus: props.autofocus, name: name, wrapperRef: wrapperRef, error: (_b = props.error) !== null && _b !== void 0 ? _b : "", invalid: props.invalid, identifier: id, descriptionIdentifier: descriptionIdentifier, description: props.description, type: "select", placeholder: props.placeholder, value: props.value, prefix: props.prefix, suffix: props.suffix, clearable: "never", maxLength: props.maxLength },
97
99
  React__default.createElement(React__default.Fragment, null,
98
- React__default.createElement("select", Object.assign({}, fieldProps, { ref: selectRef, className: inputStyle }), props.children),
99
- React__default.createElement(FormFieldPostFix, { variation: "select" }))));
100
+ React__default.createElement("select", Object.assign({}, fieldProps, { ref: selectRef, className: classnames(inputStyle, props.UNSAFE_experimentalStyles && styles.select) }), props.children),
101
+ React__default.createElement(FormFieldPostFix, { variation: "select", className: styles.selectPostfix }))));
100
102
  }
101
103
  function useSelectId(props) {
102
104
  const generatedId = useId();
@@ -107,6 +109,10 @@ function SelectOption({ children, disabled, value }) {
107
109
  return (React__default.createElement("option", { disabled: disabled, value: value }, children));
108
110
  }
109
111
 
112
+ function OptionGroup({ children, label, disabled, UNSAFE_className, UNSAFE_style, }) {
113
+ return (React__default.createElement("optgroup", { label: label, disabled: disabled, className: UNSAFE_className, style: UNSAFE_style === null || UNSAFE_style === void 0 ? void 0 : UNSAFE_style.container }, children));
114
+ }
115
+
110
116
  function isNewSelectProps(props) {
111
117
  return props.version === 2;
112
118
  }
@@ -118,5 +124,7 @@ function Select(props) {
118
124
  return React__default.createElement(Select$1, Object.assign({}, props));
119
125
  }
120
126
  }
127
+ Select.Option = SelectOption;
128
+ Select.OptionGroup = OptionGroup;
121
129
 
122
130
  export { SelectOption as Option, Select };
package/dist/index.cjs CHANGED
@@ -130,7 +130,6 @@ require('./_getTag-cjs.js');
130
130
  require('./isSymbol-cjs.js');
131
131
  require('./_baseEach-cjs.js');
132
132
  require('./debounce-cjs.js');
133
- require('react-popper');
134
133
  require('./ComboboxContent-cjs.js');
135
134
  require('./ComboboxContentSearch-cjs.js');
136
135
  require('./ComboboxContentList-cjs.js');
@@ -180,6 +179,7 @@ require('./DataListAction-cjs.js');
180
179
  require('./DataListLayoutActions-cjs.js');
181
180
  require('./DataListStatusBar-cjs.js');
182
181
  require('./throttle-cjs.js');
182
+ require('react-popper');
183
183
  require('./omit-cjs.js');
184
184
  require('./useFormFieldFocus-cjs.js');
185
185
  require('filesize');
package/dist/index.mjs CHANGED
@@ -128,7 +128,6 @@ import './_getTag-es.js';
128
128
  import './isSymbol-es.js';
129
129
  import './_baseEach-es.js';
130
130
  import './debounce-es.js';
131
- import 'react-popper';
132
131
  import './ComboboxContent-es.js';
133
132
  import './ComboboxContentSearch-es.js';
134
133
  import './ComboboxContentList-es.js';
@@ -178,6 +177,7 @@ import './DataListAction-es.js';
178
177
  import './DataListLayoutActions-es.js';
179
178
  import './DataListStatusBar-es.js';
180
179
  import './throttle-es.js';
180
+ import 'react-popper';
181
181
  import './omit-es.js';
182
182
  import './useFormFieldFocus-es.js';
183
183
  import 'filesize';
package/dist/styles.css CHANGED
@@ -3545,15 +3545,12 @@ a._7BLGtYNuJOU-.zgRx3ehZ2z8-:hover {
3545
3545
 
3546
3546
  .F7CpurjKzBI- {
3547
3547
  position: relative;
3548
- z-index: 6;
3549
- z-index: var(--elevation-menu);
3548
+ z-index: 1001;
3549
+ z-index: var(--elevation-modal);
3550
3550
  width: 100%;
3551
- }
3552
-
3553
- .J8USVG1tjPs- {
3554
- max-height: 320px;
3555
3551
  box-shadow: 0px 1px 4px 0px rgba(0, 0, 0, 0.1), 0px 4px 12px 0px rgba(0, 0, 0, 0.05);
3556
3552
  box-shadow: var(--shadow-base);
3553
+ box-sizing: border-box;
3557
3554
  padding: 8px 0;
3558
3555
  padding: var(--space-small) 0;
3559
3556
  border-radius: 8px;
@@ -6024,6 +6021,174 @@ a._7BLGtYNuJOU-.zgRx3ehZ2z8-:hover {
6024
6021
  }
6025
6022
  }
6026
6023
 
6024
+ /* stylelint-disable selector-pseudo-class-no-unknown */
6025
+ /* stylelint-disable selector-pseudo-element-no-unknown */
6026
+ /**
6027
+ * Chrome 123+ customizable select styling for option groups
6028
+ * Based on: https://developer.chrome.com/blog/a-customizable-select
6029
+ *
6030
+ * IMPORTANT: All custom styling is gated behind a feature query so that
6031
+ * unsupported browsers fall back to the native select without any layout
6032
+ * regressions in our FormField wrapper.
6033
+ */
6034
+ @supports ((-webkit-appearance: base-select) or (appearance: base-select)) {
6035
+ /* opt into customizing select */
6036
+ .-hmXAsAfH9U-,
6037
+ .-hmXAsAfH9U-::picker(select) {
6038
+ -webkit-appearance: base-select;
6039
+ appearance: base-select;
6040
+
6041
+ /* Dropdown styling */
6042
+ }
6043
+ .-hmXAsAfH9U-::picker(select), .-hmXAsAfH9U-::picker(select)::picker(select) {
6044
+ box-shadow: 0px 1px 4px 0px rgba(0, 0, 0, 0.1), 0px 4px 12px 0px rgba(0, 0, 0, 0.05);
6045
+ box-shadow: var(--shadow-base);
6046
+ margin-top: 8px;
6047
+ margin-top: var(--space-small);
6048
+ padding: 0;
6049
+ border: 1px solid hsl(200, 13%, 87%);
6050
+ border: var(--border-base) solid var(--color-border);
6051
+ border-radius: 8px;
6052
+ border-radius: var(--radius-base);
6053
+ background: rgba(255, 255, 255, 1);
6054
+ background: var(--color-surface);
6055
+ }
6056
+
6057
+ /* enable transitions in the drop down */
6058
+ .-hmXAsAfH9U-::picker(select) {
6059
+ transition:
6060
+ opacity 200ms ease,
6061
+ display 200ms allow-discrete,
6062
+ overlay 200ms allow-discrete,
6063
+ -webkit-transform 200ms ease-out;
6064
+ transition:
6065
+ opacity var(--timing-base) ease,
6066
+ display var(--timing-base) allow-discrete,
6067
+ overlay var(--timing-base) allow-discrete,
6068
+ -webkit-transform var(--timing-base) ease-out;
6069
+ transition:
6070
+ opacity 200ms ease,
6071
+ transform 200ms ease-out,
6072
+ display 200ms allow-discrete,
6073
+ overlay 200ms allow-discrete;
6074
+ transition:
6075
+ opacity var(--timing-base) ease,
6076
+ transform var(--timing-base) ease-out,
6077
+ display var(--timing-base) allow-discrete,
6078
+ overlay var(--timing-base) allow-discrete;
6079
+ transition:
6080
+ opacity 200ms ease,
6081
+ transform 200ms ease-out,
6082
+ display 200ms allow-discrete,
6083
+ overlay 200ms allow-discrete,
6084
+ -webkit-transform 200ms ease-out;
6085
+ transition:
6086
+ opacity var(--timing-base) ease,
6087
+ transform var(--timing-base) ease-out,
6088
+ display var(--timing-base) allow-discrete,
6089
+ overlay var(--timing-base) allow-discrete,
6090
+ -webkit-transform var(--timing-base) ease-out;
6091
+ }
6092
+
6093
+ .-hmXAsAfH9U-::picker-icon {
6094
+ display: none;
6095
+ }
6096
+
6097
+ .-hmXAsAfH9U-:not(:open)::picker(select) {
6098
+ opacity: 0;
6099
+ -webkit-transform: scale(0.95);
6100
+ transform: scale(0.95);
6101
+ }
6102
+
6103
+ .-hmXAsAfH9U-:open::picker(select) {
6104
+ opacity: 1;
6105
+ -webkit-transform: translateY(0) scale(1);
6106
+ transform: translateY(0) scale(1);
6107
+ }
6108
+ .-hmXAsAfH9U- {
6109
+
6110
+ /* options */
6111
+ option {
6112
+ padding: 4px 0;
6113
+ padding: var(--space-smaller) 0;
6114
+ color: hsl(198, 35%, 21%);
6115
+ color: var(--color-text);
6116
+ text-indent: 8px;
6117
+ text-indent: var(--space-small);
6118
+ cursor: pointer;
6119
+ }
6120
+
6121
+ option:hover,
6122
+ option:focus,
6123
+ option:focus-visible,
6124
+ option:checked {
6125
+ background-color: hsl(53, 21%, 93%);
6126
+ background-color: var(--color-surface--hover);
6127
+ }
6128
+
6129
+ /* optgroup headers */
6130
+ optgroup {
6131
+ padding: 8px 0 0 0;
6132
+ padding: var(--space-small) 0 0 0;
6133
+ color: hsl(197, 90%, 12%);
6134
+ color: var(--color-heading);
6135
+ font-size: 14px;
6136
+ font-size: var(--typography--fontSize-base);
6137
+ font-style: normal;
6138
+ font-weight: 700;
6139
+ text-indent: 8px;
6140
+ text-indent: var(--space-small);
6141
+ background-color: transparent;
6142
+ }
6143
+
6144
+ /* Divider directly under the group label */
6145
+ optgroup option:first-child {
6146
+ border-top: 1px solid hsl(200, 13%, 87%);
6147
+ border-top: var(--border-base) solid var(--color-border);
6148
+ }
6149
+
6150
+ /* Disabled groups and their options */
6151
+ optgroup[disabled] {
6152
+ color: hsl(0, 0%, 72%);
6153
+ color: var(--color-disabled);
6154
+ }
6155
+ optgroup[disabled] option,
6156
+ option[disabled] {
6157
+ color: hsl(0, 0%, 72%);
6158
+ color: var(--color-disabled);
6159
+ cursor: default;
6160
+ }
6161
+
6162
+ optgroup[disabled] option:focus,
6163
+ optgroup[disabled] option:focus-visible,
6164
+ optgroup[disabled] option:checked,
6165
+ optgroup[disabled] option:hover,
6166
+ option[disabled]:focus,
6167
+ option[disabled]:focus-visible,
6168
+ option[disabled]:checked,
6169
+ option[disabled]:hover {
6170
+ background-color: transparent;
6171
+ }
6172
+
6173
+ /* Animate the chevron rotation for the provided postfix class */
6174
+ }
6175
+ .-hmXAsAfH9U- + ._5ST4c1fXDYU- svg {
6176
+ transition: -webkit-transform 100ms;
6177
+ transition: -webkit-transform var(--timing-quick);
6178
+ transition: transform 100ms;
6179
+ transition: transform var(--timing-quick);
6180
+ transition: transform 100ms, -webkit-transform 100ms;
6181
+ transition: transform var(--timing-quick), -webkit-transform var(--timing-quick);
6182
+ -webkit-transform-origin: 50% 50%;
6183
+ transform-origin: 50% 50%;
6184
+ }
6185
+ /* Rotate the postfix chevron when the select is open */
6186
+ .-hmXAsAfH9U-:open + ._5ST4c1fXDYU- svg {
6187
+ -webkit-transform: rotate(180deg);
6188
+ transform: rotate(180deg);
6189
+ }
6190
+ }
6191
+
6027
6192
  .wMM6V80Rt-w- {
6028
6193
  padding: 16px;
6029
6194
  padding: var(--space-base);
@@ -11,7 +11,8 @@ var identity$1 = require('./identity-cjs.js');
11
11
  var _isIterateeCall = require('./_isIterateeCall-cjs.js');
12
12
  var debounce = require('./debounce-cjs.js');
13
13
  var Icon = require('./Icon-cjs.js');
14
- var reactPopper = require('react-popper');
14
+ var floatingUi_react = require('./floating-ui.react-cjs.js');
15
+ var maxHeight = require('./maxHeight-cjs.js');
15
16
 
16
17
  var baseEach = _baseEach._baseEach,
17
18
  isArrayLike = isTypedArray.isArrayLike_1;
@@ -310,7 +311,7 @@ function findFocusableElement(element, direction) {
310
311
  return findFocusableElement(nextElement, direction);
311
312
  }
312
313
  function useInternalChipDismissible({ children, selected, onChange, onClick, onCustomAdd, }) {
313
- const ref = React.useRef(null);
314
+ const [wrapperElement, setWrapperElement] = React.useState(null);
314
315
  const chipOptions = children.map(chip => chip.props);
315
316
  const visibleChipOptions = chipOptions.filter(chip => selected.includes(chip.value));
316
317
  const sortedVisibleChipOptions = sortBy$1(visibleChipOptions, chip => selected.indexOf(chip.value));
@@ -367,7 +368,7 @@ function useInternalChipDismissible({ children, selected, onChange, onClick, onC
367
368
  };
368
369
  },
369
370
  };
370
- return Object.assign(Object.assign({}, actions), { ref,
371
+ return Object.assign(Object.assign({}, actions), { ref: setWrapperElement, wrapperElement,
371
372
  sortedVisibleChipOptions,
372
373
  availableChipOptions });
373
374
  }
@@ -573,17 +574,37 @@ function useInView() {
573
574
  return { ref, isInView };
574
575
  }
575
576
 
577
+ const ROUNDED_BORDER_ARROW_EDGE_OFFSET = 8;
578
+ const PREFERRED_MAX_HEIGHT = 320;
576
579
  function useRepositionMenu(attachTo) {
577
- var _a;
578
- const [positionElement, setPositionedElementRef] = React.useState();
579
- const popper = reactPopper.usePopper(attachTo.current, positionElement, {
580
- modifiers: [
581
- { name: "offset", options: { offset: [0, 8] } },
582
- { name: "flip", options: { fallbackPlacements: ["top"] } },
580
+ const { refs, floatingStyles } = floatingUi_react.useFloating({
581
+ placement: "bottom",
582
+ middleware: [
583
+ floatingUi_react.offset(ROUNDED_BORDER_ARROW_EDGE_OFFSET),
584
+ floatingUi_react.flip({ fallbackPlacements: ["top"] }),
585
+ floatingUi_react.size({
586
+ apply({ availableHeight, elements, rects }) {
587
+ const maxHeight$1 = maxHeight.calculateMaxHeight(availableHeight, {
588
+ maxHeight: PREFERRED_MAX_HEIGHT,
589
+ });
590
+ Object.assign(elements.floating.style, {
591
+ maxHeight: `${maxHeight$1}px`,
592
+ maxWidth: `${rects.reference.width}px`,
593
+ });
594
+ },
595
+ }),
583
596
  ],
597
+ elements: {
598
+ reference: attachTo,
599
+ },
600
+ whileElementsMounted: floatingUi_react.autoUpdate,
584
601
  });
585
- const targetWidth = (_a = attachTo.current) === null || _a === void 0 ? void 0 : _a.clientWidth;
586
- return Object.assign(Object.assign({}, popper), { setPositionedElementRef, targetWidth });
602
+ return {
603
+ setFloatingRef: refs.setFloating,
604
+ styles: {
605
+ float: floatingStyles,
606
+ },
607
+ };
587
608
  }
588
609
 
589
610
  function useScrollToActive(index) {
@@ -1,4 +1,4 @@
1
- import React__default, { useRef, useId, useState, useEffect } from 'react';
1
+ import React__default, { useState, useId, useEffect, useRef } from 'react';
2
2
  import { g as getDefaultExportFromCjs } from './_commonjsHelpers-es.js';
3
3
  import { _ as _baseFlatten } from './_baseFlatten-es.js';
4
4
  import { a as _arrayMap, b as _baseGet } from './_baseGet-es.js';
@@ -9,7 +9,8 @@ import { i as identity_1 } from './identity-es.js';
9
9
  import { _ as _baseRest, a as _isIterateeCall } from './_isIterateeCall-es.js';
10
10
  import { a as debounce } from './debounce-es.js';
11
11
  import { I as Icon } from './Icon-es.js';
12
- import { usePopper } from 'react-popper';
12
+ import { u as useFloating, o as offset, f as flip, e as size, b as autoUpdate } from './floating-ui.react-es.js';
13
+ import { c as calculateMaxHeight } from './maxHeight-es.js';
13
14
 
14
15
  var baseEach = _baseEach,
15
16
  isArrayLike = isArrayLike_1;
@@ -308,7 +309,7 @@ function findFocusableElement(element, direction) {
308
309
  return findFocusableElement(nextElement, direction);
309
310
  }
310
311
  function useInternalChipDismissible({ children, selected, onChange, onClick, onCustomAdd, }) {
311
- const ref = useRef(null);
312
+ const [wrapperElement, setWrapperElement] = useState(null);
312
313
  const chipOptions = children.map(chip => chip.props);
313
314
  const visibleChipOptions = chipOptions.filter(chip => selected.includes(chip.value));
314
315
  const sortedVisibleChipOptions = sortBy$1(visibleChipOptions, chip => selected.indexOf(chip.value));
@@ -365,7 +366,7 @@ function useInternalChipDismissible({ children, selected, onChange, onClick, onC
365
366
  };
366
367
  },
367
368
  };
368
- return Object.assign(Object.assign({}, actions), { ref,
369
+ return Object.assign(Object.assign({}, actions), { ref: setWrapperElement, wrapperElement,
369
370
  sortedVisibleChipOptions,
370
371
  availableChipOptions });
371
372
  }
@@ -571,17 +572,37 @@ function useInView() {
571
572
  return { ref, isInView };
572
573
  }
573
574
 
575
+ const ROUNDED_BORDER_ARROW_EDGE_OFFSET = 8;
576
+ const PREFERRED_MAX_HEIGHT = 320;
574
577
  function useRepositionMenu(attachTo) {
575
- var _a;
576
- const [positionElement, setPositionedElementRef] = useState();
577
- const popper = usePopper(attachTo.current, positionElement, {
578
- modifiers: [
579
- { name: "offset", options: { offset: [0, 8] } },
580
- { name: "flip", options: { fallbackPlacements: ["top"] } },
578
+ const { refs, floatingStyles } = useFloating({
579
+ placement: "bottom",
580
+ middleware: [
581
+ offset(ROUNDED_BORDER_ARROW_EDGE_OFFSET),
582
+ flip({ fallbackPlacements: ["top"] }),
583
+ size({
584
+ apply({ availableHeight, elements, rects }) {
585
+ const maxHeight = calculateMaxHeight(availableHeight, {
586
+ maxHeight: PREFERRED_MAX_HEIGHT,
587
+ });
588
+ Object.assign(elements.floating.style, {
589
+ maxHeight: `${maxHeight}px`,
590
+ maxWidth: `${rects.reference.width}px`,
591
+ });
592
+ },
593
+ }),
581
594
  ],
595
+ elements: {
596
+ reference: attachTo,
597
+ },
598
+ whileElementsMounted: autoUpdate,
582
599
  });
583
- const targetWidth = (_a = attachTo.current) === null || _a === void 0 ? void 0 : _a.clientWidth;
584
- return Object.assign(Object.assign({}, popper), { setPositionedElementRef, targetWidth });
600
+ return {
601
+ setFloatingRef: refs.setFloating,
602
+ styles: {
603
+ float: floatingStyles,
604
+ },
605
+ };
585
606
  }
586
607
 
587
608
  function useScrollToActive(index) {
@@ -166,6 +166,8 @@
166
166
  "SegmentedControlContext.Provider",
167
167
  "SegmentedControlProvider",
168
168
  "Select",
169
+ "Select.Option",
170
+ "Select.OptionGroup",
169
171
  "SideDrawer",
170
172
  "SideDrawer.Actions",
171
173
  "SideDrawer.BackButton",
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@jobber/components",
3
- "version": "6.82.6",
3
+ "version": "6.84.0",
4
4
  "license": "MIT",
5
5
  "type": "module",
6
6
  "main": "dist/index.cjs",
@@ -547,5 +547,5 @@
547
547
  "> 1%",
548
548
  "IE 10"
549
549
  ],
550
- "gitHead": "d42f49fcff1b4ff5e5b5a6ce9ef3e16cdaeab281"
550
+ "gitHead": "6800733d34b235bdbf4d4155d412df1d1efff94b"
551
551
  }