@jobber/components 6.83.0 → 6.85.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.
- package/dist/Chips/InternalChipDismissible/InternalChipDismissibleTypes.d.ts +1 -1
- package/dist/Chips/InternalChipDismissible/hooks/index.cjs +3 -1
- package/dist/Chips/InternalChipDismissible/hooks/index.mjs +3 -1
- package/dist/Chips/InternalChipDismissible/hooks/useInternalChipDismissible.d.ts +2 -1
- package/dist/Chips/InternalChipDismissible/hooks/useRepositionMenu.d.ts +6 -15
- package/dist/Chips/InternalChipDismissible/hooks/useScrollToActive.d.ts +1 -1
- package/dist/Chips/InternalChipDismissible/index.cjs +4 -4
- package/dist/Chips/InternalChipDismissible/index.mjs +4 -4
- package/dist/Chips/index.cjs +4 -4
- package/dist/Chips/index.mjs +4 -4
- package/dist/Flex/Flex.types.d.ts +1 -1
- package/dist/Flex-cjs.js +1 -1
- package/dist/Flex-es.js +1 -1
- package/dist/Grid/Grid.d.ts +10 -4
- package/dist/Grid/index.cjs +1 -0
- package/dist/Grid/index.mjs +1 -0
- package/dist/Grid-cjs.js +16 -4
- package/dist/Grid-es.js +16 -4
- package/dist/InternalChipDismissible-cjs.js +19 -20
- package/dist/InternalChipDismissible-es.js +19 -20
- package/dist/getMappedAtlantisSpaceToken-cjs.js +1 -0
- package/dist/getMappedAtlantisSpaceToken-es.js +1 -0
- package/dist/index.cjs +1 -1
- package/dist/index.mjs +1 -1
- package/dist/sharedHelpers/types.d.ts +1 -1
- package/dist/styles.css +28 -6
- package/dist/useScrollToActive-cjs.js +32 -11
- package/dist/useScrollToActive-es.js +33 -12
- package/package.json +2 -2
|
@@ -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:
|
|
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-
|
|
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-
|
|
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").
|
|
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
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
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
|
-
|
|
9
|
-
|
|
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").
|
|
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-
|
|
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-
|
|
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';
|
package/dist/Chips/index.cjs
CHANGED
|
@@ -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-
|
|
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, }) {
|
package/dist/Chips/index.mjs
CHANGED
|
@@ -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-
|
|
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, }) {
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
export type ColumnKeys = "shrink" | "grow";
|
|
2
2
|
export type Direction = "row" | "column";
|
|
3
|
-
export declare const spacing: readonly ["none", "smallest", "smaller", "small", "base", "large"];
|
|
3
|
+
export declare const spacing: readonly ["none", "minuscule", "smallest", "smaller", "small", "slim", "base", "large", "larger", "largest", "extravagant"];
|
|
4
4
|
type ValuesOfSpacing<T extends typeof spacing> = T[number];
|
|
5
5
|
export type Spacing = ValuesOfSpacing<typeof spacing>;
|
|
6
6
|
export {};
|
package/dist/Flex-cjs.js
CHANGED
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
var React = require('react');
|
|
4
4
|
var classnames = require('classnames');
|
|
5
5
|
|
|
6
|
-
var styles = {"flexible":"pEdV7Oo29SE-","smallestGap":"ftl4BEGpmyA-","smallerGap":"ikaEWOhu3ZI-","smallGap":"V9xi4msiJlM-","baseGap":"Jzbdj1Ja38E-","largeGap":"cLrQOLCo-z8-","noneGap":"VZokN5bjMl0-","startAlign":"_9CW5WRJdMFo-","centerAlign":"zVzX2gVWEGw-","endAlign":"cnhrFSJxBCo-","spinning":"WKqP-JY0YEw-"};
|
|
6
|
+
var styles = {"flexible":"pEdV7Oo29SE-","minusculeGap":"Zm7CagsL-WU-","smallestGap":"ftl4BEGpmyA-","smallerGap":"ikaEWOhu3ZI-","smallGap":"V9xi4msiJlM-","slimGap":"odJ-gd44AYY-","baseGap":"Jzbdj1Ja38E-","largeGap":"cLrQOLCo-z8-","largerGap":"l-DqnL94mmw-","largestGap":"_4bEByMh7pHI-","extravagantGap":"pdH9lzFTcIc-","noneGap":"VZokN5bjMl0-","startAlign":"_9CW5WRJdMFo-","centerAlign":"zVzX2gVWEGw-","endAlign":"cnhrFSJxBCo-","spinning":"WKqP-JY0YEw-"};
|
|
7
7
|
|
|
8
8
|
function Flex({ align = "center", children, direction = "row", gap = "base", template, }) {
|
|
9
9
|
return (React.createElement("div", { className: classnames(styles.flexible, {
|
package/dist/Flex-es.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import React__default from 'react';
|
|
2
2
|
import classnames from 'classnames';
|
|
3
3
|
|
|
4
|
-
var styles = {"flexible":"pEdV7Oo29SE-","smallestGap":"ftl4BEGpmyA-","smallerGap":"ikaEWOhu3ZI-","smallGap":"V9xi4msiJlM-","baseGap":"Jzbdj1Ja38E-","largeGap":"cLrQOLCo-z8-","noneGap":"VZokN5bjMl0-","startAlign":"_9CW5WRJdMFo-","centerAlign":"zVzX2gVWEGw-","endAlign":"cnhrFSJxBCo-","spinning":"WKqP-JY0YEw-"};
|
|
4
|
+
var styles = {"flexible":"pEdV7Oo29SE-","minusculeGap":"Zm7CagsL-WU-","smallestGap":"ftl4BEGpmyA-","smallerGap":"ikaEWOhu3ZI-","smallGap":"V9xi4msiJlM-","slimGap":"odJ-gd44AYY-","baseGap":"Jzbdj1Ja38E-","largeGap":"cLrQOLCo-z8-","largerGap":"l-DqnL94mmw-","largestGap":"_4bEByMh7pHI-","extravagantGap":"pdH9lzFTcIc-","noneGap":"VZokN5bjMl0-","startAlign":"_9CW5WRJdMFo-","centerAlign":"zVzX2gVWEGw-","endAlign":"cnhrFSJxBCo-","spinning":"WKqP-JY0YEw-"};
|
|
5
5
|
|
|
6
6
|
function Flex({ align = "center", children, direction = "row", gap = "base", template, }) {
|
|
7
7
|
return (React__default.createElement("div", { className: classnames(styles.flexible, {
|
package/dist/Grid/Grid.d.ts
CHANGED
|
@@ -2,11 +2,18 @@ import type { ReactNode } from "react";
|
|
|
2
2
|
import React from "react";
|
|
3
3
|
import alignments from "./GridAlign.module.css";
|
|
4
4
|
import { GridCell } from "./GridCell";
|
|
5
|
-
|
|
5
|
+
import type { GapSpacing } from "../sharedHelpers/types";
|
|
6
|
+
export interface GridProps {
|
|
6
7
|
/**
|
|
7
|
-
* Add spacing between elements.
|
|
8
|
+
* Add spacing between elements. Can be a boolean for default spacing,
|
|
9
|
+
* or a semantic token for custom spacing.
|
|
10
|
+
* @default true
|
|
11
|
+
*
|
|
12
|
+
* @deprecated The boolean type for the 'gap' prop is deprecated and will be removed in a future version.
|
|
13
|
+
* Please use a GapSpacing token (e.g., 'small', 'base', 'large') for fixed spacing.
|
|
14
|
+
* Using 'true' applies default responsive spacing. Using 'false' results in no gap.
|
|
8
15
|
*/
|
|
9
|
-
readonly gap?: boolean;
|
|
16
|
+
readonly gap?: boolean | GapSpacing;
|
|
10
17
|
/**
|
|
11
18
|
* Adjust the alignment of columns. We only support a few select properties
|
|
12
19
|
* from `align-items` due to the nature of the other properties acting the
|
|
@@ -23,4 +30,3 @@ export declare function Grid({ alignItems, gap, children, }: GridProps): React.J
|
|
|
23
30
|
export declare namespace Grid {
|
|
24
31
|
var Cell: typeof GridCell;
|
|
25
32
|
}
|
|
26
|
-
export {};
|
package/dist/Grid/index.cjs
CHANGED
package/dist/Grid/index.mjs
CHANGED
package/dist/Grid-cjs.js
CHANGED
|
@@ -3,17 +3,29 @@
|
|
|
3
3
|
var React = require('react');
|
|
4
4
|
var classnames = require('classnames');
|
|
5
5
|
var GridCell = require('./GridCell-cjs.js');
|
|
6
|
+
var getMappedAtlantisSpaceToken = require('./getMappedAtlantisSpaceToken-cjs.js');
|
|
6
7
|
|
|
7
8
|
var styles = {"grid":"_0X4jj5NERa4-","gap":"d3vl57tdCWA-","spinning":"Y--XfgJk5Fw-"};
|
|
8
9
|
|
|
9
10
|
var alignments = {"center":"V-24AGDyie4-","start":"H0zdYNTapmM-","end":"O5VtcGWRV3M-","stretch":"wVv5gaWrouI-","spinning":"DcsVgHCowbg-"};
|
|
10
11
|
|
|
11
12
|
const GRID_TEST_ID = "ATL-Grid";
|
|
13
|
+
function getGapStyles(gap) {
|
|
14
|
+
if (typeof gap === "boolean") {
|
|
15
|
+
if (gap === true) {
|
|
16
|
+
return { className: styles.gap };
|
|
17
|
+
}
|
|
18
|
+
return {};
|
|
19
|
+
}
|
|
20
|
+
const gapValue = getMappedAtlantisSpaceToken.getMappedAtlantisSpaceToken(gap);
|
|
21
|
+
if (gapValue) {
|
|
22
|
+
return { style: { gap: gapValue } };
|
|
23
|
+
}
|
|
24
|
+
return {};
|
|
25
|
+
}
|
|
12
26
|
function Grid({ alignItems = "start", gap = true, children, }) {
|
|
13
|
-
const
|
|
14
|
-
|
|
15
|
-
});
|
|
16
|
-
return (React.createElement("div", { "data-testid": GRID_TEST_ID, className: classnames$1 }, children));
|
|
27
|
+
const { className: gapClass, style: gapStyle } = getGapStyles(gap);
|
|
28
|
+
return (React.createElement("div", { "data-testid": GRID_TEST_ID, className: classnames(styles.grid, alignments[alignItems], gapClass), style: gapStyle }, children));
|
|
17
29
|
}
|
|
18
30
|
Grid.Cell = GridCell.GridCell;
|
|
19
31
|
|
package/dist/Grid-es.js
CHANGED
|
@@ -1,17 +1,29 @@
|
|
|
1
1
|
import React__default from 'react';
|
|
2
2
|
import classnames from 'classnames';
|
|
3
3
|
import { a as GridCell } from './GridCell-es.js';
|
|
4
|
+
import { g as getMappedAtlantisSpaceToken } from './getMappedAtlantisSpaceToken-es.js';
|
|
4
5
|
|
|
5
6
|
var styles = {"grid":"_0X4jj5NERa4-","gap":"d3vl57tdCWA-","spinning":"Y--XfgJk5Fw-"};
|
|
6
7
|
|
|
7
8
|
var alignments = {"center":"V-24AGDyie4-","start":"H0zdYNTapmM-","end":"O5VtcGWRV3M-","stretch":"wVv5gaWrouI-","spinning":"DcsVgHCowbg-"};
|
|
8
9
|
|
|
9
10
|
const GRID_TEST_ID = "ATL-Grid";
|
|
11
|
+
function getGapStyles(gap) {
|
|
12
|
+
if (typeof gap === "boolean") {
|
|
13
|
+
if (gap === true) {
|
|
14
|
+
return { className: styles.gap };
|
|
15
|
+
}
|
|
16
|
+
return {};
|
|
17
|
+
}
|
|
18
|
+
const gapValue = getMappedAtlantisSpaceToken(gap);
|
|
19
|
+
if (gapValue) {
|
|
20
|
+
return { style: { gap: gapValue } };
|
|
21
|
+
}
|
|
22
|
+
return {};
|
|
23
|
+
}
|
|
10
24
|
function Grid({ alignItems = "start", gap = true, children, }) {
|
|
11
|
-
const
|
|
12
|
-
|
|
13
|
-
});
|
|
14
|
-
return (React__default.createElement("div", { "data-testid": GRID_TEST_ID, className: classnames$1 }, children));
|
|
25
|
+
const { className: gapClass, style: gapStyle } = getGapStyles(gap);
|
|
26
|
+
return (React__default.createElement("div", { "data-testid": GRID_TEST_ID, className: classnames(styles.grid, alignments[alignItems], gapClass), style: gapStyle }, children));
|
|
15
27
|
}
|
|
16
28
|
Grid.Cell = GridCell;
|
|
17
29
|
|
|
@@ -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
|
|
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-","
|
|
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
|
|
26
|
+
const scrollableRef = useScrollToActive.useScrollToActive(activeIndex);
|
|
28
27
|
const { ref: visibleChildRef, isInView } = useScrollToActive.useInView();
|
|
29
|
-
const { styles:
|
|
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 &&
|
|
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:
|
|
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 {
|
|
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-","
|
|
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
|
|
24
|
+
const scrollableRef = useScrollToActive(activeIndex);
|
|
26
25
|
const { ref: visibleChildRef, isInView } = useInView();
|
|
27
|
-
const { styles:
|
|
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 &&
|
|
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:
|
|
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 };
|
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';
|
|
@@ -13,5 +13,5 @@ export interface CommonAtlantisProps {
|
|
|
13
13
|
/** Represents a day of the week as a number where 0 = Sunday, 1 = Monday, etc. */
|
|
14
14
|
export type DayOfWeek = 0 | 1 | 2 | 3 | 4 | 5 | 6;
|
|
15
15
|
export type CommonAllowedElements = "section" | "p" | "article" | "ul" | "li" | "div" | "span" | "dl" | "dd" | "dt";
|
|
16
|
-
export type Spaces = "minuscule" | "slim" | "smallest" | "smaller" | "small" | "base" | "large" | "larger" | "largest" | "extravagant";
|
|
16
|
+
export type Spaces = "none" | "minuscule" | "slim" | "smallest" | "smaller" | "small" | "base" | "large" | "larger" | "largest" | "extravagant";
|
|
17
17
|
export type GapSpacing = Spaces | (string & NonNullable<unknown>);
|
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:
|
|
3549
|
-
z-index: var(--elevation-
|
|
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;
|
|
@@ -4095,6 +4092,11 @@ a._7BLGtYNuJOU-.zgRx3ehZ2z8-:hover {
|
|
|
4095
4092
|
flex: 1;
|
|
4096
4093
|
}
|
|
4097
4094
|
|
|
4095
|
+
.Zm7CagsL-WU- {
|
|
4096
|
+
gap: 1px;
|
|
4097
|
+
gap: var(--space-minuscule);
|
|
4098
|
+
}
|
|
4099
|
+
|
|
4098
4100
|
.ftl4BEGpmyA- {
|
|
4099
4101
|
gap: 2px;
|
|
4100
4102
|
gap: var(--space-smallest);
|
|
@@ -4110,6 +4112,11 @@ a._7BLGtYNuJOU-.zgRx3ehZ2z8-:hover {
|
|
|
4110
4112
|
gap: var(--space-small);
|
|
4111
4113
|
}
|
|
4112
4114
|
|
|
4115
|
+
.odJ-gd44AYY- {
|
|
4116
|
+
gap: 12px;
|
|
4117
|
+
gap: var(--space-slim);
|
|
4118
|
+
}
|
|
4119
|
+
|
|
4113
4120
|
.Jzbdj1Ja38E- {
|
|
4114
4121
|
gap: 16px;
|
|
4115
4122
|
gap: var(--space-base);
|
|
@@ -4120,6 +4127,21 @@ a._7BLGtYNuJOU-.zgRx3ehZ2z8-:hover {
|
|
|
4120
4127
|
gap: var(--space-large);
|
|
4121
4128
|
}
|
|
4122
4129
|
|
|
4130
|
+
.l-DqnL94mmw- {
|
|
4131
|
+
gap: 32px;
|
|
4132
|
+
gap: var(--space-larger);
|
|
4133
|
+
}
|
|
4134
|
+
|
|
4135
|
+
._4bEByMh7pHI- {
|
|
4136
|
+
gap: 48px;
|
|
4137
|
+
gap: var(--space-largest);
|
|
4138
|
+
}
|
|
4139
|
+
|
|
4140
|
+
.pdH9lzFTcIc- {
|
|
4141
|
+
gap: 64px;
|
|
4142
|
+
gap: var(--space-extravagant);
|
|
4143
|
+
}
|
|
4144
|
+
|
|
4123
4145
|
.VZokN5bjMl0- {
|
|
4124
4146
|
gap: 0;
|
|
4125
4147
|
}
|
|
@@ -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
|
|
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
|
|
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
|
-
|
|
578
|
-
|
|
579
|
-
|
|
580
|
-
|
|
581
|
-
{
|
|
582
|
-
{
|
|
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
|
-
|
|
586
|
-
|
|
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, {
|
|
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 {
|
|
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
|
|
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
|
-
|
|
576
|
-
|
|
577
|
-
|
|
578
|
-
|
|
579
|
-
{
|
|
580
|
-
{
|
|
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
|
-
|
|
584
|
-
|
|
600
|
+
return {
|
|
601
|
+
setFloatingRef: refs.setFloating,
|
|
602
|
+
styles: {
|
|
603
|
+
float: floatingStyles,
|
|
604
|
+
},
|
|
605
|
+
};
|
|
585
606
|
}
|
|
586
607
|
|
|
587
608
|
function useScrollToActive(index) {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@jobber/components",
|
|
3
|
-
"version": "6.
|
|
3
|
+
"version": "6.85.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": "
|
|
550
|
+
"gitHead": "d1e41d8cd060ab3c9bdc2a4419228cf8e3fe3242"
|
|
551
551
|
}
|