@jobber/components 6.80.0 → 6.82.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/Autocomplete/constants.d.ts +0 -1
- package/dist/Autocomplete/index.cjs +2 -1
- package/dist/Autocomplete/index.mjs +2 -1
- package/dist/Autocomplete-cjs.js +5 -7
- package/dist/Autocomplete-es.js +5 -7
- package/dist/Card/index.cjs +1 -1
- package/dist/Card/index.mjs +1 -1
- package/dist/Chips/InternalChipDismissible/hooks/index.cjs +1 -0
- package/dist/Chips/InternalChipDismissible/hooks/index.mjs +1 -0
- package/dist/Chips/InternalChipDismissible/index.cjs +1 -0
- package/dist/Chips/InternalChipDismissible/index.mjs +1 -0
- package/dist/Chips/index.cjs +1 -0
- package/dist/Chips/index.mjs +1 -0
- package/dist/Combobox/hooks/useComboboxAccessibility.d.ts +2 -2
- package/dist/ComboboxContent-cjs.js +11 -15
- package/dist/ComboboxContent-es.js +12 -16
- package/dist/DataDump/index.cjs +1 -1
- package/dist/DataDump/index.mjs +1 -1
- package/dist/DataTable/DataTable.d.ts +16 -0
- package/dist/DataTable/components/DataTableActions.d.ts +2 -0
- package/dist/DataTable/components/DataTableBody.d.ts +2 -0
- package/dist/DataTable/components/DataTableCell.d.ts +2 -0
- package/dist/DataTable/components/DataTableContainer.d.ts +2 -0
- package/dist/DataTable/components/DataTableFooter.d.ts +9 -0
- package/dist/DataTable/components/DataTableHeader.d.ts +2 -0
- package/dist/DataTable/components/DataTableHeaderCell.d.ts +5 -0
- package/dist/DataTable/components/DataTablePagination.d.ts +5 -0
- package/dist/DataTable/components/DataTablePaginationButton.d.ts +21 -0
- package/dist/DataTable/components/DataTableRow.d.ts +2 -0
- package/dist/DataTable/components/DataTableRowActions.d.ts +4 -0
- package/dist/DataTable/components/DataTableSortableHeader.d.ts +18 -0
- package/dist/DataTable/components/DataTableTable.d.ts +2 -0
- package/dist/DataTable/components/index.cjs +27 -0
- package/dist/DataTable/components/index.d.ts +13 -0
- package/dist/DataTable/components/index.mjs +9 -0
- package/dist/DataTable/index.cjs +6 -0
- package/dist/DataTable/index.d.ts +1 -0
- package/dist/DataTable/index.mjs +1 -0
- package/dist/DataTable-cjs.js +40 -60
- package/dist/DataTable-es.js +37 -57
- package/dist/DataTableTable-cjs.js +127 -0
- package/dist/DataTableTable-es.js +112 -0
- package/dist/Menu/index.cjs +1 -1
- package/dist/Menu/index.mjs +1 -1
- package/dist/Menu-cjs.js +10 -16
- package/dist/Menu-es.js +10 -16
- package/dist/Modal/index.mjs +1 -1
- package/dist/Page/index.cjs +1 -1
- package/dist/Page/index.mjs +1 -1
- package/dist/Popover/PopoverContext.d.ts +2 -2
- package/dist/Popover/index.cjs +1 -1
- package/dist/Popover/index.mjs +1 -1
- package/dist/Popover/usePopover.d.ts +3 -6
- package/dist/Popover-cjs.js +17 -17
- package/dist/Popover-es.js +18 -18
- package/dist/floating-ui.react-es.js +1 -1
- package/dist/index.cjs +3 -1
- package/dist/index.mjs +3 -1
- package/dist/maxHeight-cjs.js +24 -0
- package/dist/maxHeight-es.js +22 -0
- package/dist/styles.css +134 -0
- package/dist/useScrollToActive-cjs.js +5 -2
- package/dist/useScrollToActive-es.js +5 -2
- package/dist/utils/maxHeight.d.ts +23 -0
- package/dist/utils/meta/meta.json +13 -0
- package/package.json +2 -2
|
@@ -9,11 +9,12 @@ require('../useIsMounted-cjs.js');
|
|
|
9
9
|
require('../useSafeLayoutEffect-cjs.js');
|
|
10
10
|
require('../floating-ui.react-cjs.js');
|
|
11
11
|
require('react-dom');
|
|
12
|
+
require('../maxHeight-cjs.js');
|
|
13
|
+
require('@jobber/design');
|
|
12
14
|
require('../Heading-cjs.js');
|
|
13
15
|
require('../Typography-cjs.js');
|
|
14
16
|
require('../Text-cjs.js');
|
|
15
17
|
require('../Icon-cjs.js');
|
|
16
|
-
require('@jobber/design');
|
|
17
18
|
require('../useOnKeyDown-cjs.js');
|
|
18
19
|
require('../InputText/index.cjs');
|
|
19
20
|
require('../FormField-cjs.js');
|
|
@@ -7,11 +7,12 @@ import '../useIsMounted-es.js';
|
|
|
7
7
|
import '../useSafeLayoutEffect-es.js';
|
|
8
8
|
import '../floating-ui.react-es.js';
|
|
9
9
|
import 'react-dom';
|
|
10
|
+
import '../maxHeight-es.js';
|
|
11
|
+
import '@jobber/design';
|
|
10
12
|
import '../Heading-es.js';
|
|
11
13
|
import '../Typography-es.js';
|
|
12
14
|
import '../Text-es.js';
|
|
13
15
|
import '../Icon-es.js';
|
|
14
|
-
import '@jobber/design';
|
|
15
16
|
import '../useOnKeyDown-es.js';
|
|
16
17
|
import '../InputText/index.mjs';
|
|
17
18
|
import '../FormField-es.js';
|
package/dist/Autocomplete-cjs.js
CHANGED
|
@@ -7,6 +7,7 @@ var classnames = require('classnames');
|
|
|
7
7
|
var useIsMounted = require('./useIsMounted-cjs.js');
|
|
8
8
|
var floatingUi_react = require('./floating-ui.react-cjs.js');
|
|
9
9
|
var useSafeLayoutEffect = require('./useSafeLayoutEffect-cjs.js');
|
|
10
|
+
var maxHeight = require('./maxHeight-cjs.js');
|
|
10
11
|
var Heading = require('./Heading-cjs.js');
|
|
11
12
|
var Text = require('./Text-cjs.js');
|
|
12
13
|
var Icon = require('./Icon-cjs.js');
|
|
@@ -17,7 +18,6 @@ var FormField = require('./FormField-cjs.js');
|
|
|
17
18
|
var styles = {"autocomplete":"_7mObJiwfPh4-","options":"dL5JShAJlKM-","heading":"PWZL-94hH7k-","visible":"_2RzcnTdaPyc-","option":"y9zhi8Wr8QA-","active":"_3Xg49dtL1Q8-","separator":"LIeh390F3W8-","icon":"K2phy6IC3TY-","text":"a6-LbUm5WnY-","label":"tQNbuxcE9nU-","details":"qacStG9-XbE-","spinning":"P9cQDL4MZ-s-"};
|
|
18
19
|
|
|
19
20
|
const AUTOCOMPLETE_MAX_HEIGHT = 300;
|
|
20
|
-
const AUTCOMPLETE_MIN_HEIGHT = 100;
|
|
21
21
|
|
|
22
22
|
function useRepositionMenu(attachTo, visible, cssManagedVisibility) {
|
|
23
23
|
const { refs, floatingStyles, update } = floatingUi_react.useFloating(Object.assign({ placement: "bottom", middleware: [
|
|
@@ -25,13 +25,11 @@ function useRepositionMenu(attachTo, visible, cssManagedVisibility) {
|
|
|
25
25
|
floatingUi_react.flip({ fallbackPlacements: ["top"] }),
|
|
26
26
|
floatingUi_react.size({
|
|
27
27
|
apply({ availableHeight, elements }) {
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
? AUTOCOMPLETE_MAX_HEIGHT
|
|
32
|
-
: Math.max(AUTCOMPLETE_MIN_HEIGHT, availableHeight);
|
|
28
|
+
const maxHeight$1 = maxHeight.calculateMaxHeight(availableHeight, {
|
|
29
|
+
maxHeight: AUTOCOMPLETE_MAX_HEIGHT,
|
|
30
|
+
});
|
|
33
31
|
Object.assign(elements.floating.style, {
|
|
34
|
-
maxHeight: `${maxHeight}px`,
|
|
32
|
+
maxHeight: `${maxHeight$1}px`,
|
|
35
33
|
});
|
|
36
34
|
},
|
|
37
35
|
}),
|
package/dist/Autocomplete-es.js
CHANGED
|
@@ -3,8 +3,9 @@ import React__default, { useCallback, useEffect, useState, forwardRef, useMemo,
|
|
|
3
3
|
import { u as useDebounce_2 } from './useDebounce-es.js';
|
|
4
4
|
import classnames from 'classnames';
|
|
5
5
|
import { u as useIsMounted_2 } from './useIsMounted-es.js';
|
|
6
|
-
import { u as useFloating, o as offset, f as flip,
|
|
6
|
+
import { u as useFloating, o as offset, f as flip, e as size, b as autoUpdate, F as FloatingPortal } from './floating-ui.react-es.js';
|
|
7
7
|
import { u as useSafeLayoutEffect_1 } from './useSafeLayoutEffect-es.js';
|
|
8
|
+
import { c as calculateMaxHeight } from './maxHeight-es.js';
|
|
8
9
|
import { H as Heading } from './Heading-es.js';
|
|
9
10
|
import { T as Text } from './Text-es.js';
|
|
10
11
|
import { I as Icon } from './Icon-es.js';
|
|
@@ -15,7 +16,6 @@ import { m as mergeRefs } from './FormField-es.js';
|
|
|
15
16
|
var styles = {"autocomplete":"_7mObJiwfPh4-","options":"dL5JShAJlKM-","heading":"PWZL-94hH7k-","visible":"_2RzcnTdaPyc-","option":"y9zhi8Wr8QA-","active":"_3Xg49dtL1Q8-","separator":"LIeh390F3W8-","icon":"K2phy6IC3TY-","text":"a6-LbUm5WnY-","label":"tQNbuxcE9nU-","details":"qacStG9-XbE-","spinning":"P9cQDL4MZ-s-"};
|
|
16
17
|
|
|
17
18
|
const AUTOCOMPLETE_MAX_HEIGHT = 300;
|
|
18
|
-
const AUTCOMPLETE_MIN_HEIGHT = 100;
|
|
19
19
|
|
|
20
20
|
function useRepositionMenu(attachTo, visible, cssManagedVisibility) {
|
|
21
21
|
const { refs, floatingStyles, update } = useFloating(Object.assign({ placement: "bottom", middleware: [
|
|
@@ -23,11 +23,9 @@ function useRepositionMenu(attachTo, visible, cssManagedVisibility) {
|
|
|
23
23
|
flip({ fallbackPlacements: ["top"] }),
|
|
24
24
|
size({
|
|
25
25
|
apply({ availableHeight, elements }) {
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
? AUTOCOMPLETE_MAX_HEIGHT
|
|
30
|
-
: Math.max(AUTCOMPLETE_MIN_HEIGHT, availableHeight);
|
|
26
|
+
const maxHeight = calculateMaxHeight(availableHeight, {
|
|
27
|
+
maxHeight: AUTOCOMPLETE_MAX_HEIGHT,
|
|
28
|
+
});
|
|
31
29
|
Object.assign(elements.floating.style, {
|
|
32
30
|
maxHeight: `${maxHeight}px`,
|
|
33
31
|
});
|
package/dist/Card/index.cjs
CHANGED
|
@@ -12,7 +12,6 @@ require('../Icon-cjs.js');
|
|
|
12
12
|
require('@jobber/design');
|
|
13
13
|
require('../Menu-cjs.js');
|
|
14
14
|
require('framer-motion');
|
|
15
|
-
require('../useOnKeyDown-cjs.js');
|
|
16
15
|
require('../useRefocusOnActivator-cjs.js');
|
|
17
16
|
require('../floating-ui.react-cjs.js');
|
|
18
17
|
require('react-dom');
|
|
@@ -20,6 +19,7 @@ require('../useFocusTrap-cjs.js');
|
|
|
20
19
|
require('../useIsMounted-cjs.js');
|
|
21
20
|
require('../useSafeLayoutEffect-cjs.js');
|
|
22
21
|
require('../useFormFieldFocus-cjs.js');
|
|
22
|
+
require('../maxHeight-cjs.js');
|
|
23
23
|
|
|
24
24
|
|
|
25
25
|
|
package/dist/Card/index.mjs
CHANGED
|
@@ -10,7 +10,6 @@ import '../Icon-es.js';
|
|
|
10
10
|
import '@jobber/design';
|
|
11
11
|
import '../Menu-es.js';
|
|
12
12
|
import 'framer-motion';
|
|
13
|
-
import '../useOnKeyDown-es.js';
|
|
14
13
|
import '../useRefocusOnActivator-es.js';
|
|
15
14
|
import '../floating-ui.react-es.js';
|
|
16
15
|
import 'react-dom';
|
|
@@ -18,3 +17,4 @@ import '../useFocusTrap-es.js';
|
|
|
18
17
|
import '../useIsMounted-es.js';
|
|
19
18
|
import '../useSafeLayoutEffect-es.js';
|
|
20
19
|
import '../useFormFieldFocus-es.js';
|
|
20
|
+
import '../maxHeight-es.js';
|
|
@@ -20,6 +20,7 @@ require('../../Icon-cjs.js');
|
|
|
20
20
|
require('@jobber/design');
|
|
21
21
|
require('../../floating-ui.react-cjs.js');
|
|
22
22
|
require('react-dom');
|
|
23
|
+
require('../../maxHeight-cjs.js');
|
|
23
24
|
require('classnames');
|
|
24
25
|
require('../../useSafeLayoutEffect-cjs.js');
|
|
25
26
|
require('../../Text-cjs.js');
|
package/dist/Chips/index.cjs
CHANGED
package/dist/Chips/index.mjs
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import { UseInteractionsReturn } from "@floating-ui/react";
|
|
2
2
|
import { ComboboxOption } from "../Combobox.types";
|
|
3
3
|
export declare function useComboboxAccessibility(selectionCallback: (selection: ComboboxOption) => void, filteredOptions: ComboboxOption[], optionsListRef: React.RefObject<HTMLUListElement>, open: boolean, wrapperRef: React.RefObject<HTMLDivElement>): {
|
|
4
|
-
|
|
5
|
-
|
|
4
|
+
floatingRef: React.RefObject<HTMLDivElement>;
|
|
5
|
+
floatingStyles: React.CSSProperties;
|
|
6
6
|
floatingProps: ReturnType<UseInteractionsReturn["getFloatingProps"]>;
|
|
7
7
|
nodeId?: string;
|
|
8
8
|
parentNodeId: string | null;
|
|
@@ -3,7 +3,6 @@
|
|
|
3
3
|
var React = require('react');
|
|
4
4
|
var classnames = require('classnames');
|
|
5
5
|
var floatingUi_react = require('./floating-ui.react-cjs.js');
|
|
6
|
-
var ReactDOM = require('react-dom');
|
|
7
6
|
var ComboboxContentSearch = require('./ComboboxContentSearch-cjs.js');
|
|
8
7
|
var ComboboxContentList = require('./ComboboxContentList-cjs.js');
|
|
9
8
|
var ComboboxContentHeader = require('./ComboboxContentHeader-cjs.js');
|
|
@@ -52,12 +51,12 @@ function useComboboxAccessibility(selectionCallback, filteredOptions, optionsLis
|
|
|
52
51
|
const parentNodeId = floatingUi_react.useFloatingParentNodeId();
|
|
53
52
|
const nodeId = floatingUi_react.useFloatingNodeId();
|
|
54
53
|
useRefocusOnActivator.useRefocusOnActivator_2(open);
|
|
55
|
-
const
|
|
54
|
+
const floatingRef = useFocusTrap.useFocusTrap_2(open);
|
|
56
55
|
const { floatingStyles, update, context } = floatingUi_react.useFloating({
|
|
57
56
|
nodeId,
|
|
58
57
|
elements: {
|
|
59
58
|
reference: wrapperRef.current,
|
|
60
|
-
floating:
|
|
59
|
+
floating: floatingRef.current,
|
|
61
60
|
},
|
|
62
61
|
open,
|
|
63
62
|
onOpenChange: openState => {
|
|
@@ -65,9 +64,8 @@ function useComboboxAccessibility(selectionCallback, filteredOptions, optionsLis
|
|
|
65
64
|
handleClose();
|
|
66
65
|
},
|
|
67
66
|
middleware: [
|
|
68
|
-
floatingUi_react.autoPlacement({ allowedPlacements: ["bottom-start", "top-start"] }),
|
|
69
67
|
floatingUi_react.offset(COMBOBOX_OFFSET),
|
|
70
|
-
floatingUi_react.
|
|
68
|
+
floatingUi_react.flip({ fallbackPlacements: ["top-start", "bottom-end", "top-end"] }),
|
|
71
69
|
],
|
|
72
70
|
placement: "bottom-start",
|
|
73
71
|
whileElementsMounted: floatingUi_react.autoUpdate,
|
|
@@ -83,11 +81,11 @@ function useComboboxAccessibility(selectionCallback, filteredOptions, optionsLis
|
|
|
83
81
|
React.useEffect(() => {
|
|
84
82
|
var _a;
|
|
85
83
|
if (open) {
|
|
86
|
-
(_a =
|
|
84
|
+
(_a = floatingRef.current) === null || _a === void 0 ? void 0 : _a.addEventListener("keydown", handleContentKeydown);
|
|
87
85
|
}
|
|
88
86
|
return () => {
|
|
89
87
|
var _a;
|
|
90
|
-
(_a =
|
|
88
|
+
(_a = floatingRef.current) === null || _a === void 0 ? void 0 : _a.removeEventListener("keydown", handleContentKeydown);
|
|
91
89
|
};
|
|
92
90
|
}, [open, optionsListRef, filteredOptions]);
|
|
93
91
|
function handleContentKeydown(event) {
|
|
@@ -126,8 +124,8 @@ function useComboboxAccessibility(selectionCallback, filteredOptions, optionsLis
|
|
|
126
124
|
}
|
|
127
125
|
}
|
|
128
126
|
return {
|
|
129
|
-
|
|
130
|
-
|
|
127
|
+
floatingRef,
|
|
128
|
+
floatingStyles,
|
|
131
129
|
floatingProps: getFloatingProps(),
|
|
132
130
|
nodeId,
|
|
133
131
|
parentNodeId,
|
|
@@ -137,7 +135,7 @@ function useComboboxAccessibility(selectionCallback, filteredOptions, optionsLis
|
|
|
137
135
|
function ComboboxContent(props) {
|
|
138
136
|
const optionsExist = props.options.length > 0;
|
|
139
137
|
const { onClear, onSelectAll, optionsListRef } = useComboboxContent(props.open, props.selected);
|
|
140
|
-
const {
|
|
138
|
+
const { floatingRef, floatingStyles, floatingProps, nodeId, parentNodeId } = useComboboxAccessibility(props.handleSelection, props.options, optionsListRef, props.open, props.wrapperRef);
|
|
141
139
|
// options that are passed back to consumers via onSelectAll callback
|
|
142
140
|
// should only contain id and label
|
|
143
141
|
const optionsData = React.useMemo(() => {
|
|
@@ -146,9 +144,9 @@ function ComboboxContent(props) {
|
|
|
146
144
|
label: option.label,
|
|
147
145
|
}));
|
|
148
146
|
}, [props.options]);
|
|
149
|
-
const content = (React.createElement("div", Object.assign({ ref:
|
|
147
|
+
const content = (React.createElement("div", Object.assign({ ref: floatingRef, id: constants.COMBOBOX_MENU_ID, "data-testid": constants.COMBOBOX_MENU_ID, "data-elevation": "elevated", tabIndex: 0, className: classnames(styles.content, {
|
|
150
148
|
[styles.hidden]: !props.open,
|
|
151
|
-
}), style:
|
|
149
|
+
}), style: floatingStyles }, floatingProps),
|
|
152
150
|
React.createElement(ComboboxContentSearch.ComboboxContentSearch, { open: props.open, placeholder: props.subjectNoun, searchValue: props.searchValue, setSearchValue: props.setSearchValue, handleSearchChange: props.handleSearchChange }),
|
|
153
151
|
props.multiselect && (optionsExist || props.selected.length > 0) && (React.createElement(ComboboxContentHeader.ComboboxContentHeader, { hasOptionsVisible: optionsExist, subjectNoun: props.subjectNoun, selectedCount: props.selected.length, onClearAll: () => {
|
|
154
152
|
props.selectedStateSetter([]);
|
|
@@ -166,9 +164,7 @@ function ComboboxContent(props) {
|
|
|
166
164
|
React.createElement(floatingUi_react.FloatingNode, { id: nodeId },
|
|
167
165
|
React.createElement(floatingUi_react.FloatingPortal, null, content))));
|
|
168
166
|
}
|
|
169
|
-
return (globalThis === null || globalThis === void 0 ? void 0 : globalThis.document)
|
|
170
|
-
? ReactDOM.createPortal(content, document.body)
|
|
171
|
-
: content;
|
|
167
|
+
return (globalThis === null || globalThis === void 0 ? void 0 : globalThis.document) ? (React.createElement(floatingUi_react.FloatingPortal, null, content)) : (content);
|
|
172
168
|
}
|
|
173
169
|
|
|
174
170
|
exports.ComboboxContent = ComboboxContent;
|
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
import React__default, { useContext, useRef, useEffect, useMemo } from 'react';
|
|
2
2
|
import classnames from 'classnames';
|
|
3
|
-
import {
|
|
4
|
-
import ReactDOM__default from 'react-dom';
|
|
3
|
+
import { g as useFloatingParentNodeId, h as useFloatingNodeId, u as useFloating, o as offset, f as flip, b as autoUpdate, c as useDismiss, d as useInteractions, i as FloatingTree, j as FloatingNode, F as FloatingPortal } from './floating-ui.react-es.js';
|
|
5
4
|
import { C as ComboboxContentSearch } from './ComboboxContentSearch-es.js';
|
|
6
5
|
import { C as ComboboxContentList } from './ComboboxContentList-es.js';
|
|
7
6
|
import { C as ComboboxContentHeader } from './ComboboxContentHeader-es.js';
|
|
@@ -50,12 +49,12 @@ function useComboboxAccessibility(selectionCallback, filteredOptions, optionsLis
|
|
|
50
49
|
const parentNodeId = useFloatingParentNodeId();
|
|
51
50
|
const nodeId = useFloatingNodeId();
|
|
52
51
|
useRefocusOnActivator_2(open);
|
|
53
|
-
const
|
|
52
|
+
const floatingRef = useFocusTrap_2(open);
|
|
54
53
|
const { floatingStyles, update, context } = useFloating({
|
|
55
54
|
nodeId,
|
|
56
55
|
elements: {
|
|
57
56
|
reference: wrapperRef.current,
|
|
58
|
-
floating:
|
|
57
|
+
floating: floatingRef.current,
|
|
59
58
|
},
|
|
60
59
|
open,
|
|
61
60
|
onOpenChange: openState => {
|
|
@@ -63,9 +62,8 @@ function useComboboxAccessibility(selectionCallback, filteredOptions, optionsLis
|
|
|
63
62
|
handleClose();
|
|
64
63
|
},
|
|
65
64
|
middleware: [
|
|
66
|
-
autoPlacement({ allowedPlacements: ["bottom-start", "top-start"] }),
|
|
67
65
|
offset(COMBOBOX_OFFSET),
|
|
68
|
-
|
|
66
|
+
flip({ fallbackPlacements: ["top-start", "bottom-end", "top-end"] }),
|
|
69
67
|
],
|
|
70
68
|
placement: "bottom-start",
|
|
71
69
|
whileElementsMounted: autoUpdate,
|
|
@@ -81,11 +79,11 @@ function useComboboxAccessibility(selectionCallback, filteredOptions, optionsLis
|
|
|
81
79
|
useEffect(() => {
|
|
82
80
|
var _a;
|
|
83
81
|
if (open) {
|
|
84
|
-
(_a =
|
|
82
|
+
(_a = floatingRef.current) === null || _a === void 0 ? void 0 : _a.addEventListener("keydown", handleContentKeydown);
|
|
85
83
|
}
|
|
86
84
|
return () => {
|
|
87
85
|
var _a;
|
|
88
|
-
(_a =
|
|
86
|
+
(_a = floatingRef.current) === null || _a === void 0 ? void 0 : _a.removeEventListener("keydown", handleContentKeydown);
|
|
89
87
|
};
|
|
90
88
|
}, [open, optionsListRef, filteredOptions]);
|
|
91
89
|
function handleContentKeydown(event) {
|
|
@@ -124,8 +122,8 @@ function useComboboxAccessibility(selectionCallback, filteredOptions, optionsLis
|
|
|
124
122
|
}
|
|
125
123
|
}
|
|
126
124
|
return {
|
|
127
|
-
|
|
128
|
-
|
|
125
|
+
floatingRef,
|
|
126
|
+
floatingStyles,
|
|
129
127
|
floatingProps: getFloatingProps(),
|
|
130
128
|
nodeId,
|
|
131
129
|
parentNodeId,
|
|
@@ -135,7 +133,7 @@ function useComboboxAccessibility(selectionCallback, filteredOptions, optionsLis
|
|
|
135
133
|
function ComboboxContent(props) {
|
|
136
134
|
const optionsExist = props.options.length > 0;
|
|
137
135
|
const { onClear, onSelectAll, optionsListRef } = useComboboxContent(props.open, props.selected);
|
|
138
|
-
const {
|
|
136
|
+
const { floatingRef, floatingStyles, floatingProps, nodeId, parentNodeId } = useComboboxAccessibility(props.handleSelection, props.options, optionsListRef, props.open, props.wrapperRef);
|
|
139
137
|
// options that are passed back to consumers via onSelectAll callback
|
|
140
138
|
// should only contain id and label
|
|
141
139
|
const optionsData = useMemo(() => {
|
|
@@ -144,9 +142,9 @@ function ComboboxContent(props) {
|
|
|
144
142
|
label: option.label,
|
|
145
143
|
}));
|
|
146
144
|
}, [props.options]);
|
|
147
|
-
const content = (React__default.createElement("div", Object.assign({ ref:
|
|
145
|
+
const content = (React__default.createElement("div", Object.assign({ ref: floatingRef, id: COMBOBOX_MENU_ID, "data-testid": COMBOBOX_MENU_ID, "data-elevation": "elevated", tabIndex: 0, className: classnames(styles.content, {
|
|
148
146
|
[styles.hidden]: !props.open,
|
|
149
|
-
}), style:
|
|
147
|
+
}), style: floatingStyles }, floatingProps),
|
|
150
148
|
React__default.createElement(ComboboxContentSearch, { open: props.open, placeholder: props.subjectNoun, searchValue: props.searchValue, setSearchValue: props.setSearchValue, handleSearchChange: props.handleSearchChange }),
|
|
151
149
|
props.multiselect && (optionsExist || props.selected.length > 0) && (React__default.createElement(ComboboxContentHeader, { hasOptionsVisible: optionsExist, subjectNoun: props.subjectNoun, selectedCount: props.selected.length, onClearAll: () => {
|
|
152
150
|
props.selectedStateSetter([]);
|
|
@@ -164,9 +162,7 @@ function ComboboxContent(props) {
|
|
|
164
162
|
React__default.createElement(FloatingNode, { id: nodeId },
|
|
165
163
|
React__default.createElement(FloatingPortal, null, content))));
|
|
166
164
|
}
|
|
167
|
-
return (globalThis === null || globalThis === void 0 ? void 0 : globalThis.document)
|
|
168
|
-
? ReactDOM__default.createPortal(content, document.body)
|
|
169
|
-
: content;
|
|
165
|
+
return (globalThis === null || globalThis === void 0 ? void 0 : globalThis.document) ? (React__default.createElement(FloatingPortal, null, content)) : (content);
|
|
170
166
|
}
|
|
171
167
|
|
|
172
168
|
export { ComboboxContent as C };
|
package/dist/DataDump/index.cjs
CHANGED
|
@@ -13,7 +13,6 @@ require('../Icon-cjs.js');
|
|
|
13
13
|
require('@jobber/design');
|
|
14
14
|
require('../Menu-cjs.js');
|
|
15
15
|
require('framer-motion');
|
|
16
|
-
require('../useOnKeyDown-cjs.js');
|
|
17
16
|
require('../useRefocusOnActivator-cjs.js');
|
|
18
17
|
require('../floating-ui.react-cjs.js');
|
|
19
18
|
require('react-dom');
|
|
@@ -21,6 +20,7 @@ require('../useFocusTrap-cjs.js');
|
|
|
21
20
|
require('../useIsMounted-cjs.js');
|
|
22
21
|
require('../useSafeLayoutEffect-cjs.js');
|
|
23
22
|
require('../useFormFieldFocus-cjs.js');
|
|
23
|
+
require('../maxHeight-cjs.js');
|
|
24
24
|
require('../Content-cjs.js');
|
|
25
25
|
require('../Emphasis-cjs.js');
|
|
26
26
|
|
package/dist/DataDump/index.mjs
CHANGED
|
@@ -11,7 +11,6 @@ import '../Icon-es.js';
|
|
|
11
11
|
import '@jobber/design';
|
|
12
12
|
import '../Menu-es.js';
|
|
13
13
|
import 'framer-motion';
|
|
14
|
-
import '../useOnKeyDown-es.js';
|
|
15
14
|
import '../useRefocusOnActivator-es.js';
|
|
16
15
|
import '../floating-ui.react-es.js';
|
|
17
16
|
import 'react-dom';
|
|
@@ -19,5 +18,6 @@ import '../useFocusTrap-es.js';
|
|
|
19
18
|
import '../useIsMounted-es.js';
|
|
20
19
|
import '../useSafeLayoutEffect-es.js';
|
|
21
20
|
import '../useFormFieldFocus-es.js';
|
|
21
|
+
import '../maxHeight-es.js';
|
|
22
22
|
import '../Content-es.js';
|
|
23
23
|
import '../Emphasis-es.js';
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import { ColumnDef, Row } from "@tanstack/react-table";
|
|
2
2
|
import React, { ReactNode } from "react";
|
|
3
3
|
import { PaginationType, SortingType } from "./types";
|
|
4
|
+
import { DataTableActions, DataTableBody, DataTableContainer, DataTableFooter, DataTableHeader, DataTableHeaderCell, DataTablePagination, DataTablePaginationButton, DataTableRowActions, DataTableSortableHeader, DataTableTable } from "./components";
|
|
4
5
|
export interface DataTableProps<T> {
|
|
5
6
|
/**
|
|
6
7
|
* The actual data that will be used for the table.
|
|
@@ -55,3 +56,18 @@ export interface DataTableProps<T> {
|
|
|
55
56
|
readonly loading?: boolean;
|
|
56
57
|
}
|
|
57
58
|
export declare function DataTable<T extends object>({ data, columns, pagination, sorting, height, stickyHeader, pinFirstColumn, onRowClick, emptyState, loading, }: DataTableProps<T>): React.JSX.Element;
|
|
59
|
+
export declare namespace DataTable {
|
|
60
|
+
var Table: typeof DataTableTable;
|
|
61
|
+
var Header: typeof DataTableHeader;
|
|
62
|
+
var HeaderCell: typeof DataTableHeaderCell;
|
|
63
|
+
var Row: React.ForwardRefExoticComponent<React.HTMLAttributes<HTMLTableRowElement> & React.RefAttributes<HTMLTableRowElement>>;
|
|
64
|
+
var Cell: React.ForwardRefExoticComponent<React.TdHTMLAttributes<HTMLTableCellElement> & React.RefAttributes<HTMLTableCellElement>>;
|
|
65
|
+
var RowActions: typeof DataTableRowActions;
|
|
66
|
+
var Actions: typeof DataTableActions;
|
|
67
|
+
var Body: typeof DataTableBody;
|
|
68
|
+
var Container: typeof DataTableContainer;
|
|
69
|
+
var SortableHeader: typeof DataTableSortableHeader;
|
|
70
|
+
var Footer: typeof DataTableFooter;
|
|
71
|
+
var Pagination: typeof DataTablePagination;
|
|
72
|
+
var PaginationButton: typeof DataTablePaginationButton;
|
|
73
|
+
}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import React from "react";
|
|
2
|
+
export interface DataTableFooterProps extends React.HTMLAttributes<HTMLTableSectionElement> {
|
|
3
|
+
readonly children: React.ReactNode;
|
|
4
|
+
/**
|
|
5
|
+
* Number of columns to span across. This should match the number of columns in your table.
|
|
6
|
+
*/
|
|
7
|
+
readonly colSpan: number;
|
|
8
|
+
}
|
|
9
|
+
export declare function DataTableFooter({ children, className, colSpan, ...props }: DataTableFooterProps): React.JSX.Element;
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
import React from "react";
|
|
2
|
+
export interface DataTablePaginationProps extends React.HTMLAttributes<HTMLDivElement> {
|
|
3
|
+
readonly children: React.ReactNode;
|
|
4
|
+
}
|
|
5
|
+
export declare function DataTablePagination({ children, className, ...props }: DataTablePaginationProps): React.JSX.Element;
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import React from "react";
|
|
2
|
+
export interface DataTablePaginationButtonProps {
|
|
3
|
+
/**
|
|
4
|
+
* The direction of the pagination button
|
|
5
|
+
*/
|
|
6
|
+
readonly direction: "previous" | "next";
|
|
7
|
+
/**
|
|
8
|
+
* Callback function when the pagination button is clicked
|
|
9
|
+
*/
|
|
10
|
+
readonly onClick?: () => void;
|
|
11
|
+
/**
|
|
12
|
+
* Whether the pagination button is disabled
|
|
13
|
+
*/
|
|
14
|
+
readonly disabled?: boolean;
|
|
15
|
+
/**
|
|
16
|
+
* Function that returns the aria-label for the button. Required for accessibility.
|
|
17
|
+
* Should return translated strings based on the direction parameter.
|
|
18
|
+
*/
|
|
19
|
+
readonly ariaLabel: (direction: "previous" | "next") => string;
|
|
20
|
+
}
|
|
21
|
+
export declare function DataTablePaginationButton({ direction, onClick, disabled, ariaLabel, }: DataTablePaginationButtonProps): React.JSX.Element;
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import React from "react";
|
|
2
|
+
import { SortDirection } from "../SortIcon";
|
|
3
|
+
export interface DataTableSortableHeaderProps {
|
|
4
|
+
/**
|
|
5
|
+
* The header content to display (text, icons, etc.)
|
|
6
|
+
*/
|
|
7
|
+
readonly children: React.ReactNode;
|
|
8
|
+
/**
|
|
9
|
+
* The current sort direction for this column. When undefined, the header renders as non-interactive.
|
|
10
|
+
*/
|
|
11
|
+
readonly direction?: SortDirection;
|
|
12
|
+
/**
|
|
13
|
+
* Callback function triggered when the sortable header is clicked.
|
|
14
|
+
* When undefined, the header renders as non-interactive.
|
|
15
|
+
*/
|
|
16
|
+
readonly onSort?: () => void;
|
|
17
|
+
}
|
|
18
|
+
export declare function DataTableSortableHeader(props: DataTableSortableHeaderProps & React.HTMLAttributes<HTMLTableCellElement>): JSX.Element;
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
var DataTableTable = require('../../DataTableTable-cjs.js');
|
|
4
|
+
require('react');
|
|
5
|
+
require('classnames');
|
|
6
|
+
require('../../tslib.es6-cjs.js');
|
|
7
|
+
require('../../Button-cjs.js');
|
|
8
|
+
require('react-router-dom');
|
|
9
|
+
require('../../Icon-cjs.js');
|
|
10
|
+
require('@jobber/design');
|
|
11
|
+
require('../../Typography-cjs.js');
|
|
12
|
+
|
|
13
|
+
|
|
14
|
+
|
|
15
|
+
exports.DataTableActions = DataTableTable.DataTableActions;
|
|
16
|
+
exports.DataTableBody = DataTableTable.DataTableBody;
|
|
17
|
+
exports.DataTableCell = DataTableTable.DataTableCell;
|
|
18
|
+
exports.DataTableContainer = DataTableTable.DataTableContainer;
|
|
19
|
+
exports.DataTableFooter = DataTableTable.DataTableFooter;
|
|
20
|
+
exports.DataTableHeader = DataTableTable.DataTableHeader;
|
|
21
|
+
exports.DataTableHeaderCell = DataTableTable.DataTableHeaderCell;
|
|
22
|
+
exports.DataTablePagination = DataTableTable.DataTablePagination;
|
|
23
|
+
exports.DataTablePaginationButton = DataTableTable.DataTablePaginationButton;
|
|
24
|
+
exports.DataTableRow = DataTableTable.DataTableRow;
|
|
25
|
+
exports.DataTableRowActions = DataTableTable.DataTableRowActions;
|
|
26
|
+
exports.DataTableSortableHeader = DataTableTable.DataTableSortableHeader;
|
|
27
|
+
exports.DataTableTable = DataTableTable.DataTableTable;
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
export { DataTableActions } from "./DataTableActions";
|
|
2
|
+
export { DataTableBody } from "./DataTableBody";
|
|
3
|
+
export { DataTableCell } from "./DataTableCell";
|
|
4
|
+
export { DataTableContainer } from "./DataTableContainer";
|
|
5
|
+
export { DataTableFooter } from "./DataTableFooter";
|
|
6
|
+
export { DataTableHeader } from "./DataTableHeader";
|
|
7
|
+
export { DataTableHeaderCell } from "./DataTableHeaderCell";
|
|
8
|
+
export { DataTablePagination } from "./DataTablePagination";
|
|
9
|
+
export { DataTablePaginationButton } from "./DataTablePaginationButton";
|
|
10
|
+
export { DataTableRow } from "./DataTableRow";
|
|
11
|
+
export { DataTableRowActions } from "./DataTableRowActions";
|
|
12
|
+
export { DataTableSortableHeader } from "./DataTableSortableHeader";
|
|
13
|
+
export { DataTableTable } from "./DataTableTable";
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
export { D as DataTableActions, b as DataTableBody, c as DataTableCell, d as DataTableContainer, e as DataTableFooter, f as DataTableHeader, g as DataTableHeaderCell, h as DataTablePagination, i as DataTablePaginationButton, j as DataTableRow, k as DataTableRowActions, l as DataTableSortableHeader, m as DataTableTable } from '../../DataTableTable-es.js';
|
|
2
|
+
import 'react';
|
|
3
|
+
import 'classnames';
|
|
4
|
+
import '../../tslib.es6-es.js';
|
|
5
|
+
import '../../Button-es.js';
|
|
6
|
+
import 'react-router-dom';
|
|
7
|
+
import '../../Icon-es.js';
|
|
8
|
+
import '@jobber/design';
|
|
9
|
+
import '../../Typography-es.js';
|
package/dist/DataTable/index.cjs
CHANGED
|
@@ -2,6 +2,7 @@
|
|
|
2
2
|
|
|
3
3
|
var DataTable = require('../DataTable-cjs.js');
|
|
4
4
|
var helpers = require('../helpers-cjs.js');
|
|
5
|
+
var DataTableTable = require('../DataTableTable-cjs.js');
|
|
5
6
|
var reactTable = require('@tanstack/react-table');
|
|
6
7
|
require('classnames');
|
|
7
8
|
require('react');
|
|
@@ -41,6 +42,11 @@ require('react-hook-form');
|
|
|
41
42
|
|
|
42
43
|
exports.DataTable = DataTable.DataTable;
|
|
43
44
|
exports.mockContainerWidth = helpers.mockContainerWidth;
|
|
45
|
+
Object.defineProperty(exports, "SortDirection", {
|
|
46
|
+
enumerable: true,
|
|
47
|
+
get: function () { return DataTableTable.SortDirection; }
|
|
48
|
+
});
|
|
49
|
+
exports.SortIcon = DataTableTable.SortIcon;
|
|
44
50
|
Object.defineProperty(exports, "createColumnHelper", {
|
|
45
51
|
enumerable: true,
|
|
46
52
|
get: function () { return reactTable.createColumnHelper; }
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
export { DataTable } from "./DataTable";
|
|
2
2
|
export * from "./types";
|
|
3
3
|
export * from "./test-utilities/helpers";
|
|
4
|
+
export { SortIcon, SortDirection } from "./SortIcon";
|
|
4
5
|
export { Row, ColumnDef, createColumnHelper, PaginationState, SortingState, } from "@tanstack/react-table";
|