@jobber/components 6.31.2-exp-chips-3fddd2b.0 → 6.33.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/DataList/DataList.types.d.ts +8 -0
- package/dist/DataListSearch-cjs.js +4 -2
- package/dist/DataListSearch-es.js +4 -2
- package/dist/Heading/Heading.d.ts +14 -2
- package/dist/Heading-cjs.js +2 -2
- package/dist/Heading-es.js +2 -2
- package/dist/InternalChipDismissible-cjs.js +1 -1
- package/dist/InternalChipDismissible-es.js +1 -1
- package/dist/useDebounce-cjs.js +1 -1
- package/dist/useDebounce-es.js +1 -1
- package/dist/utils/useDebounce.d.ts +1 -1
- package/package.json +2 -2
|
@@ -167,6 +167,14 @@ export interface DataListSearchProps {
|
|
|
167
167
|
* absolutely have to.
|
|
168
168
|
*/
|
|
169
169
|
readonly initialValue?: string;
|
|
170
|
+
/**
|
|
171
|
+
* The controlled value of the search input.
|
|
172
|
+
*
|
|
173
|
+
* Supply this field if you want to take control over the search input's
|
|
174
|
+
* value. You'll need to use `onSearch` to handle updating your state with
|
|
175
|
+
* the latest value.
|
|
176
|
+
*/
|
|
177
|
+
readonly value?: string;
|
|
170
178
|
readonly onSearch: (value: string) => void;
|
|
171
179
|
}
|
|
172
180
|
export interface DataListFiltersProps {
|
|
@@ -28,7 +28,7 @@ function InternalDataListSearch() {
|
|
|
28
28
|
const debouncedSearch = React.useCallback(debounce.debounce((value) => { var _a; return (_a = searchComponent === null || searchComponent === void 0 ? void 0 : searchComponent.props) === null || _a === void 0 ? void 0 : _a.onSearch(value); }, DataList_const.SEARCH_DEBOUNCE_DELAY), [searchComponent === null || searchComponent === void 0 ? void 0 : searchComponent.props.onSearch]);
|
|
29
29
|
if (!searchComponent)
|
|
30
30
|
return null;
|
|
31
|
-
const { placeholder, initialValue } = searchComponent.props;
|
|
31
|
+
const { placeholder, initialValue, value: controlledValue, } = searchComponent.props;
|
|
32
32
|
return (React.createElement("div", { className: classnames(styles.wrapper, {
|
|
33
33
|
[styles.withNoFilters]: !filterComponent && !sorting,
|
|
34
34
|
}) },
|
|
@@ -39,7 +39,9 @@ function InternalDataListSearch() {
|
|
|
39
39
|
// If the initial value changes, reset the input.
|
|
40
40
|
, {
|
|
41
41
|
// If the initial value changes, reset the input.
|
|
42
|
-
key: initialValue, defaultValue: initialValue, ref: inputRef, placeholder: getPlaceholder(), onChange:
|
|
42
|
+
key: initialValue, defaultValue: initialValue, value: controlledValue, ref: inputRef, placeholder: getPlaceholder(), onChange: controlledValue !== undefined
|
|
43
|
+
? searchComponent.props.onSearch
|
|
44
|
+
: debouncedSearch, prefix: { icon: "search" }, clearable: "always" })),
|
|
43
45
|
React.createElement("div", { className: styles.searchButton },
|
|
44
46
|
React.createElement(AnimatedSwitcher.AnimatedSwitcher, { switched: visible, initialChild: React.createElement(Button.Button, { variation: "subtle", icon: "search", ariaLabel: "Search", onClick: toggleSearch }), switchTo: React.createElement(Button.Button, { variation: "subtle", icon: "remove", ariaLabel: "Close search bar", onClick: toggleSearch }) }))));
|
|
45
47
|
function getPlaceholder() {
|
|
@@ -26,7 +26,7 @@ function InternalDataListSearch() {
|
|
|
26
26
|
const debouncedSearch = useCallback(debounce((value) => { var _a; return (_a = searchComponent === null || searchComponent === void 0 ? void 0 : searchComponent.props) === null || _a === void 0 ? void 0 : _a.onSearch(value); }, SEARCH_DEBOUNCE_DELAY), [searchComponent === null || searchComponent === void 0 ? void 0 : searchComponent.props.onSearch]);
|
|
27
27
|
if (!searchComponent)
|
|
28
28
|
return null;
|
|
29
|
-
const { placeholder, initialValue } = searchComponent.props;
|
|
29
|
+
const { placeholder, initialValue, value: controlledValue, } = searchComponent.props;
|
|
30
30
|
return (React__default.createElement("div", { className: classnames(styles.wrapper, {
|
|
31
31
|
[styles.withNoFilters]: !filterComponent && !sorting,
|
|
32
32
|
}) },
|
|
@@ -37,7 +37,9 @@ function InternalDataListSearch() {
|
|
|
37
37
|
// If the initial value changes, reset the input.
|
|
38
38
|
, {
|
|
39
39
|
// If the initial value changes, reset the input.
|
|
40
|
-
key: initialValue, defaultValue: initialValue, ref: inputRef, placeholder: getPlaceholder(), onChange:
|
|
40
|
+
key: initialValue, defaultValue: initialValue, value: controlledValue, ref: inputRef, placeholder: getPlaceholder(), onChange: controlledValue !== undefined
|
|
41
|
+
? searchComponent.props.onSearch
|
|
42
|
+
: debouncedSearch, prefix: { icon: "search" }, clearable: "always" })),
|
|
41
43
|
React__default.createElement("div", { className: styles.searchButton },
|
|
42
44
|
React__default.createElement(AnimatedSwitcher, { switched: visible, initialChild: React__default.createElement(Button, { variation: "subtle", icon: "search", ariaLabel: "Search", onClick: toggleSearch }), switchTo: React__default.createElement(Button, { variation: "subtle", icon: "remove", ariaLabel: "Close search bar", onClick: toggleSearch }) }))));
|
|
43
45
|
function getPlaceholder() {
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { ReactNode } from "react";
|
|
2
|
-
import { TypographyOptions } from "../Typography";
|
|
2
|
+
import { TypographyOptions, TypographyProps } from "../Typography";
|
|
3
3
|
type HeadingLevel = 1 | 2 | 3 | 4 | 5 | 6;
|
|
4
4
|
interface HeadingProps {
|
|
5
5
|
/**
|
|
@@ -11,7 +11,19 @@ interface HeadingProps {
|
|
|
11
11
|
* Allows overriding of the element rendered. Defaults to the heading specified with level.
|
|
12
12
|
*/
|
|
13
13
|
readonly element?: "h1" | "h2" | "h3" | "h4" | "h5" | "h6" | "p" | "span";
|
|
14
|
+
/**
|
|
15
|
+
* **Use at your own risk:** Custom classNames for specific elements. This should only be used as a
|
|
16
|
+
* **last resort**. Using this may result in unexpected side effects.
|
|
17
|
+
* More information in the [Customizing components Guide](https://atlantis.getjobber.com/guides/customizing-components).
|
|
18
|
+
*/
|
|
19
|
+
readonly UNSAFE_className?: TypographyProps["UNSAFE_className"];
|
|
20
|
+
/**
|
|
21
|
+
* **Use at your own risk:** Custom styles for specific elements. This should only be used as a
|
|
22
|
+
* **last resort**. Using this may result in unexpected side effects.
|
|
23
|
+
* More information in the [Customizing components Guide](https://atlantis.getjobber.com/guides/customizing-components).
|
|
24
|
+
*/
|
|
25
|
+
readonly UNSAFE_style?: TypographyProps["UNSAFE_style"];
|
|
14
26
|
}
|
|
15
27
|
export type LevelMap = Record<HeadingLevel, TypographyOptions>;
|
|
16
|
-
export declare function Heading({ level, children, element }: HeadingProps): JSX.Element;
|
|
28
|
+
export declare function Heading({ level, children, element, UNSAFE_className, UNSAFE_style, }: HeadingProps): JSX.Element;
|
|
17
29
|
export {};
|
package/dist/Heading-cjs.js
CHANGED
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
var React = require('react');
|
|
4
4
|
var Typography = require('./Typography-cjs.js');
|
|
5
5
|
|
|
6
|
-
function Heading({ level = 5, children, element }) {
|
|
6
|
+
function Heading({ level = 5, children, element, UNSAFE_className, UNSAFE_style, }) {
|
|
7
7
|
const levelMap = {
|
|
8
8
|
1: {
|
|
9
9
|
element: "h1",
|
|
@@ -43,7 +43,7 @@ function Heading({ level = 5, children, element }) {
|
|
|
43
43
|
textColor: "heading",
|
|
44
44
|
},
|
|
45
45
|
};
|
|
46
|
-
return (React.createElement(Typography.Typography, Object.assign({}, levelMap[level], { element: element || levelMap[level].element }), children));
|
|
46
|
+
return (React.createElement(Typography.Typography, Object.assign({}, levelMap[level], { element: element || levelMap[level].element, UNSAFE_className: UNSAFE_className, UNSAFE_style: UNSAFE_style }), children));
|
|
47
47
|
}
|
|
48
48
|
|
|
49
49
|
exports.Heading = Heading;
|
package/dist/Heading-es.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import React__default from 'react';
|
|
2
2
|
import { T as Typography } from './Typography-es.js';
|
|
3
3
|
|
|
4
|
-
function Heading({ level = 5, children, element }) {
|
|
4
|
+
function Heading({ level = 5, children, element, UNSAFE_className, UNSAFE_style, }) {
|
|
5
5
|
const levelMap = {
|
|
6
6
|
1: {
|
|
7
7
|
element: "h1",
|
|
@@ -41,7 +41,7 @@ function Heading({ level = 5, children, element }) {
|
|
|
41
41
|
textColor: "heading",
|
|
42
42
|
},
|
|
43
43
|
};
|
|
44
|
-
return (React__default.createElement(Typography, Object.assign({}, levelMap[level], { element: element || levelMap[level].element }), children));
|
|
44
|
+
return (React__default.createElement(Typography, Object.assign({}, levelMap[level], { element: element || levelMap[level].element, UNSAFE_className: UNSAFE_className, UNSAFE_style: UNSAFE_style }), children));
|
|
45
45
|
}
|
|
46
46
|
|
|
47
47
|
export { Heading as H };
|
|
@@ -43,7 +43,7 @@ function InternalChipDismissibleInput(props) {
|
|
|
43
43
|
}
|
|
44
44
|
return (React.createElement(React.Fragment, null,
|
|
45
45
|
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": hasAvailableOptions, "aria-activedescendant": generateDescendantId(activeIndex), value: searchValue, onChange: handleSearchChange, onKeyDown: handleKeyDown, onBlur: debounce.debounce(handleBlur, 200), onFocus: handleOpenMenu, autoFocus: true }),
|
|
46
|
-
|
|
46
|
+
(hasAvailableOptions || isLoadingMore) && (React.createElement("div", Object.assign({ ref: setPositionedElementRef, className: styles.menu, style: popperStyles.popper }, attributes.popper),
|
|
47
47
|
React.createElement("div", { ref: menuRef, role: "listbox", id: menuId, className: styles.menuList, "data-testid": "chip-menu" },
|
|
48
48
|
allOptions.map((option, i) => (React.createElement("button", { key: option.value, role: "option", type: "button", id: generateDescendantId(i), className: classnames(styles.menuListOption, {
|
|
49
49
|
[styles.activeOption]: activeIndex === i,
|
|
@@ -41,7 +41,7 @@ function InternalChipDismissibleInput(props) {
|
|
|
41
41
|
}
|
|
42
42
|
return (React__default.createElement(React__default.Fragment, null,
|
|
43
43
|
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": hasAvailableOptions, "aria-activedescendant": generateDescendantId(activeIndex), value: searchValue, onChange: handleSearchChange, onKeyDown: handleKeyDown, onBlur: debounce(handleBlur, 200), onFocus: handleOpenMenu, autoFocus: true }),
|
|
44
|
-
|
|
44
|
+
(hasAvailableOptions || isLoadingMore) && (React__default.createElement("div", Object.assign({ ref: setPositionedElementRef, className: styles.menu, style: popperStyles.popper }, attributes.popper),
|
|
45
45
|
React__default.createElement("div", { ref: menuRef, role: "listbox", id: menuId, className: styles.menuList, "data-testid": "chip-menu" },
|
|
46
46
|
allOptions.map((option, i) => (React__default.createElement("button", { key: option.value, role: "option", type: "button", id: generateDescendantId(i), className: classnames(styles.menuListOption, {
|
|
47
47
|
[styles.activeOption]: activeIndex === i,
|
package/dist/useDebounce-cjs.js
CHANGED
|
@@ -19,7 +19,7 @@ function useDebounce(func, wait, options) {
|
|
|
19
19
|
funcRef.current = func;
|
|
20
20
|
}
|
|
21
21
|
const debounced = React.useMemo(() => {
|
|
22
|
-
return debounce.debounce(() => funcRef.current(), wait, options);
|
|
22
|
+
return debounce.debounce((...args) => funcRef.current(...args), wait, options);
|
|
23
23
|
// Note: do not add any dependencies! There is currently no use case where we would change
|
|
24
24
|
// the wait delay or options between renders. By not tracking as dependencies, this allows
|
|
25
25
|
// consumers of useDebounce to provide a raw object for options rather than forcing them to
|
package/dist/useDebounce-es.js
CHANGED
|
@@ -17,7 +17,7 @@ function useDebounce(func, wait, options) {
|
|
|
17
17
|
funcRef.current = func;
|
|
18
18
|
}
|
|
19
19
|
const debounced = useMemo(() => {
|
|
20
|
-
return debounce(() => funcRef.current(), wait, options);
|
|
20
|
+
return debounce((...args) => funcRef.current(...args), wait, options);
|
|
21
21
|
// Note: do not add any dependencies! There is currently no use case where we would change
|
|
22
22
|
// the wait delay or options between renders. By not tracking as dependencies, this allows
|
|
23
23
|
// consumers of useDebounce to provide a raw object for options rather than forcing them to
|
|
@@ -7,5 +7,5 @@ type AnyFunction = (...args: any[]) => any;
|
|
|
7
7
|
* @param options Optional debounce settings.
|
|
8
8
|
* @returns The debounced function.
|
|
9
9
|
*/
|
|
10
|
-
export declare function useDebounce<T extends AnyFunction>(func: T, wait: number, options?: Parameters<typeof debounce>[2]): import("lodash").DebouncedFunc<() => any>;
|
|
10
|
+
export declare function useDebounce<T extends AnyFunction>(func: T, wait: number, options?: Parameters<typeof debounce>[2]): import("lodash").DebouncedFunc<(...args: Parameters<T>) => any>;
|
|
11
11
|
export {};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@jobber/components",
|
|
3
|
-
"version": "6.
|
|
3
|
+
"version": "6.33.0",
|
|
4
4
|
"license": "MIT",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "dist/index.cjs",
|
|
@@ -490,5 +490,5 @@
|
|
|
490
490
|
"> 1%",
|
|
491
491
|
"IE 10"
|
|
492
492
|
],
|
|
493
|
-
"gitHead": "
|
|
493
|
+
"gitHead": "7bd069382ee7b6ad7b80e54457eab37016902192"
|
|
494
494
|
}
|