@jobber/components 6.121.0 → 6.121.1-JOB-161185-eeb3cdb.2
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/Chip/Chip.d.ts +7 -1
- package/dist/Chip/Chip.types.d.ts +10 -2
- package/dist/Chip/index.cjs +1 -1
- package/dist/Chip/index.mjs +1 -1
- package/dist/Chip-cjs.js +40 -25
- package/dist/Chip-es.js +40 -25
- package/dist/Combobox/components/ComboboxTrigger/index.cjs +1 -1
- package/dist/Combobox/components/ComboboxTrigger/index.mjs +1 -1
- package/dist/InternalChipDismissible-cjs.js +1 -1
- package/dist/InternalChipDismissible-es.js +1 -1
- package/package.json +2 -2
package/dist/Chip/Chip.d.ts
CHANGED
|
@@ -2,7 +2,13 @@ import React from "react";
|
|
|
2
2
|
import { ChipPrefix } from "./components/ChipPrefix/Chip.Prefix";
|
|
3
3
|
import { ChipSuffix } from "./components/ChipSuffix/Chip.Suffix";
|
|
4
4
|
import type { ChipProps } from "./Chip.types";
|
|
5
|
-
|
|
5
|
+
type ChipElement = HTMLButtonElement | HTMLDivElement;
|
|
6
|
+
export declare const Chip: React.ForwardRefExoticComponent<ChipProps & React.HTMLAttributes<ChipElement> & {
|
|
7
|
+
readonly "data-testid"?: string;
|
|
8
|
+
readonly className?: string;
|
|
9
|
+
readonly style?: React.CSSProperties;
|
|
10
|
+
} & React.RefAttributes<HTMLDivElement | HTMLButtonElement>> & {
|
|
6
11
|
Prefix: typeof ChipPrefix;
|
|
7
12
|
Suffix: typeof ChipSuffix;
|
|
8
13
|
};
|
|
14
|
+
export {};
|
|
@@ -44,9 +44,17 @@ export interface ChipProps extends PropsWithChildren {
|
|
|
44
44
|
*/
|
|
45
45
|
readonly variation?: ChipVariations;
|
|
46
46
|
/**
|
|
47
|
-
* Chip
|
|
47
|
+
* Chip click callback using a standard event-first signature.
|
|
48
|
+
*
|
|
49
|
+
* The event is passed as both the first and second argument for backwards
|
|
50
|
+
* compatibility with consumers that were written against the legacy
|
|
51
|
+
* `(value, event)` shape (e.g. `(_, event) => event.stopPropagation()`).
|
|
48
52
|
*/
|
|
49
|
-
readonly onClick?: (
|
|
53
|
+
readonly onClick?: (ev: React.MouseEvent<HTMLButtonElement | HTMLDivElement>, evAlias?: React.MouseEvent<HTMLButtonElement | HTMLDivElement>) => void;
|
|
54
|
+
/**
|
|
55
|
+
* Backwards-compatible value-first click callback used by selectable chips.
|
|
56
|
+
*/
|
|
57
|
+
readonly onClickValue?: (value: string | number | undefined, ev: React.MouseEvent<HTMLButtonElement | HTMLDivElement>) => void;
|
|
50
58
|
/**
|
|
51
59
|
* Callback. Called when you keydown on Chip. Ships the event, so you can get the key pushed.
|
|
52
60
|
*/
|
package/dist/Chip/index.cjs
CHANGED
|
@@ -2,6 +2,7 @@
|
|
|
2
2
|
|
|
3
3
|
var Chip = require('../Chip-cjs.js');
|
|
4
4
|
var ChipDismissible = require('../ChipDismissible-cjs.js');
|
|
5
|
+
require('../tslib.es6-cjs.js');
|
|
5
6
|
require('react');
|
|
6
7
|
require('classnames');
|
|
7
8
|
require('@jobber/hooks');
|
|
@@ -17,7 +18,6 @@ require('../floating-ui.react-dom-cjs.js');
|
|
|
17
18
|
require('react-dom');
|
|
18
19
|
require('react/jsx-runtime');
|
|
19
20
|
require('framer-motion');
|
|
20
|
-
require('../tslib.es6-cjs.js');
|
|
21
21
|
|
|
22
22
|
|
|
23
23
|
|
package/dist/Chip/index.mjs
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
export { C as Chip } from '../Chip-es.js';
|
|
2
2
|
export { a as ChipDismissible, C as ChipSelectable } from '../ChipDismissible-es.js';
|
|
3
|
+
import '../tslib.es6-es.js';
|
|
3
4
|
import 'react';
|
|
4
5
|
import 'classnames';
|
|
5
6
|
import '@jobber/hooks';
|
|
@@ -15,4 +16,3 @@ import '../floating-ui.react-dom-es.js';
|
|
|
15
16
|
import 'react-dom';
|
|
16
17
|
import 'react/jsx-runtime';
|
|
17
18
|
import 'framer-motion';
|
|
18
|
-
import '../tslib.es6-es.js';
|
package/dist/Chip-cjs.js
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
|
+
var tslib_es6 = require('./tslib.es6-cjs.js');
|
|
3
4
|
var React = require('react');
|
|
4
5
|
var classnames = require('classnames');
|
|
5
6
|
var jobberHooks = require('@jobber/hooks');
|
|
@@ -64,13 +65,14 @@ function ChipSuffix({ children, className, onClick, testID, ariaLabel, }) {
|
|
|
64
65
|
return (React.createElement("span", { className: classnames(onClick ? styles$1.clickableSuffix : styles$1.suffix, className, !singleChild && styles$1.empty), onClick: handleClick, onKeyPress: handleClick, role: onClick ? "button" : undefined, tabIndex: onClick ? 0 : undefined, "data-testid": testID, "aria-label": ariaLabel }, singleChild));
|
|
65
66
|
}
|
|
66
67
|
|
|
67
|
-
const ChipComponent = React.forwardRef((
|
|
68
|
+
const ChipComponent = React.forwardRef((_a, ref) => {
|
|
69
|
+
var { ariaLabel, "aria-label": ariaLabelProp, disabled, heading, invalid, label, value, testID, onClick, onClickValue, onKeyDown, children, role = "button", tabIndex = 0, variation = "base", className, style, onFocus, onBlur, onPointerDown, onPointerUp, onPointerEnter, onPointerLeave, onMouseDown, onMouseUp, onMouseEnter, onMouseLeave, onTouchStart, onTouchEnd, onContextMenu, title, "data-testid": dataTestId } = _a, rest = tslib_es6.__rest(_a, ["ariaLabel", "aria-label", "disabled", "heading", "invalid", "label", "value", "testID", "onClick", "onClickValue", "onKeyDown", "children", "role", "tabIndex", "variation", "className", "style", "onFocus", "onBlur", "onPointerDown", "onPointerUp", "onPointerEnter", "onPointerLeave", "onMouseDown", "onMouseUp", "onMouseEnter", "onMouseLeave", "onTouchStart", "onTouchEnd", "onContextMenu", "title", "data-testid"]);
|
|
68
70
|
const classes = classnames(styles$1.chip, {
|
|
69
71
|
[styles$1.invalid]: invalid,
|
|
70
72
|
[styles$1.base]: variation === "base",
|
|
71
73
|
[styles$1.subtle]: variation === "subtle",
|
|
72
74
|
[styles$1.disabled]: disabled,
|
|
73
|
-
});
|
|
75
|
+
}, className);
|
|
74
76
|
const prefix = useChildComponent.useChildComponent(children, d => d.type === ChipPrefix);
|
|
75
77
|
const suffix = useChildComponent.useChildComponent(children, d => d.type === ChipSuffix);
|
|
76
78
|
const [labelRef, labelFullyVisible] = jobberHooks.useInView();
|
|
@@ -90,29 +92,42 @@ const ChipComponent = React.forwardRef(({ ariaLabel, disabled, heading, invalid,
|
|
|
90
92
|
!labelFullyVisible && (React.createElement("div", { className: styles$1.truncateGradient, "data-testid": "ATL-Chip-Truncation-Gradient" },
|
|
91
93
|
React.createElement("span", null)))),
|
|
92
94
|
suffix));
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
?
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
"data-testid": testID,
|
|
114
|
-
|
|
115
|
-
|
|
95
|
+
const isClickable = Boolean(onClick || onClickValue);
|
|
96
|
+
const handleClick = (ev) => {
|
|
97
|
+
onClick === null || onClick === void 0 ? void 0 : onClick(ev, ev);
|
|
98
|
+
onClickValue === null || onClickValue === void 0 ? void 0 : onClickValue(value, ev);
|
|
99
|
+
};
|
|
100
|
+
return (React.createElement(Tooltip.Tooltip, { message: tooltipMessage, setTabIndex: false }, isClickable
|
|
101
|
+
? React.createElement("button", Object.assign(Object.assign({}, rest), { className: classes, style, onClick: handleClick, tabIndex: disabled ? -1 : tabIndex, onKeyDown,
|
|
102
|
+
onFocus,
|
|
103
|
+
onBlur,
|
|
104
|
+
onPointerDown,
|
|
105
|
+
onPointerUp,
|
|
106
|
+
onPointerEnter,
|
|
107
|
+
onPointerLeave,
|
|
108
|
+
onMouseDown,
|
|
109
|
+
onMouseUp,
|
|
110
|
+
onMouseEnter,
|
|
111
|
+
onMouseLeave,
|
|
112
|
+
onTouchStart,
|
|
113
|
+
onTouchEnd,
|
|
114
|
+
onContextMenu, "aria-label": ariaLabel !== null && ariaLabel !== void 0 ? ariaLabel : ariaLabelProp, disabled,
|
|
115
|
+
role, "data-testid": testID !== null && testID !== void 0 ? testID : dataTestId, title, type: "button", ref }), chipContent)
|
|
116
|
+
: React.createElement("div", Object.assign(Object.assign({}, rest), { className: classes, style, tabIndex: disabled ? -1 : tabIndex, onKeyDown,
|
|
117
|
+
onFocus,
|
|
118
|
+
onBlur,
|
|
119
|
+
onPointerDown,
|
|
120
|
+
onPointerUp,
|
|
121
|
+
onPointerEnter,
|
|
122
|
+
onPointerLeave,
|
|
123
|
+
onMouseDown,
|
|
124
|
+
onMouseUp,
|
|
125
|
+
onMouseEnter,
|
|
126
|
+
onMouseLeave,
|
|
127
|
+
onTouchStart,
|
|
128
|
+
onTouchEnd,
|
|
129
|
+
onContextMenu, "aria-label": ariaLabel !== null && ariaLabel !== void 0 ? ariaLabel : ariaLabelProp, role, "data-testid": testID !== null && testID !== void 0 ? testID : dataTestId, title,
|
|
130
|
+
ref }), chipContent)));
|
|
116
131
|
});
|
|
117
132
|
function getTooltipMessage(labelFullyVisible, headingFullyVisible, label, heading) {
|
|
118
133
|
let message = "";
|
package/dist/Chip-es.js
CHANGED
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { _ as __rest } from './tslib.es6-es.js';
|
|
1
2
|
import React__default, { useRef, forwardRef } from 'react';
|
|
2
3
|
import classnames from 'classnames';
|
|
3
4
|
import { useInView } from '@jobber/hooks';
|
|
@@ -62,13 +63,14 @@ function ChipSuffix({ children, className, onClick, testID, ariaLabel, }) {
|
|
|
62
63
|
return (React__default.createElement("span", { className: classnames(onClick ? styles$1.clickableSuffix : styles$1.suffix, className, !singleChild && styles$1.empty), onClick: handleClick, onKeyPress: handleClick, role: onClick ? "button" : undefined, tabIndex: onClick ? 0 : undefined, "data-testid": testID, "aria-label": ariaLabel }, singleChild));
|
|
63
64
|
}
|
|
64
65
|
|
|
65
|
-
const ChipComponent = forwardRef((
|
|
66
|
+
const ChipComponent = forwardRef((_a, ref) => {
|
|
67
|
+
var { ariaLabel, "aria-label": ariaLabelProp, disabled, heading, invalid, label, value, testID, onClick, onClickValue, onKeyDown, children, role = "button", tabIndex = 0, variation = "base", className, style, onFocus, onBlur, onPointerDown, onPointerUp, onPointerEnter, onPointerLeave, onMouseDown, onMouseUp, onMouseEnter, onMouseLeave, onTouchStart, onTouchEnd, onContextMenu, title, "data-testid": dataTestId } = _a, rest = __rest(_a, ["ariaLabel", "aria-label", "disabled", "heading", "invalid", "label", "value", "testID", "onClick", "onClickValue", "onKeyDown", "children", "role", "tabIndex", "variation", "className", "style", "onFocus", "onBlur", "onPointerDown", "onPointerUp", "onPointerEnter", "onPointerLeave", "onMouseDown", "onMouseUp", "onMouseEnter", "onMouseLeave", "onTouchStart", "onTouchEnd", "onContextMenu", "title", "data-testid"]);
|
|
66
68
|
const classes = classnames(styles$1.chip, {
|
|
67
69
|
[styles$1.invalid]: invalid,
|
|
68
70
|
[styles$1.base]: variation === "base",
|
|
69
71
|
[styles$1.subtle]: variation === "subtle",
|
|
70
72
|
[styles$1.disabled]: disabled,
|
|
71
|
-
});
|
|
73
|
+
}, className);
|
|
72
74
|
const prefix = useChildComponent(children, d => d.type === ChipPrefix);
|
|
73
75
|
const suffix = useChildComponent(children, d => d.type === ChipSuffix);
|
|
74
76
|
const [labelRef, labelFullyVisible] = useInView();
|
|
@@ -88,29 +90,42 @@ const ChipComponent = forwardRef(({ ariaLabel, disabled, heading, invalid, label
|
|
|
88
90
|
!labelFullyVisible && (React__default.createElement("div", { className: styles$1.truncateGradient, "data-testid": "ATL-Chip-Truncation-Gradient" },
|
|
89
91
|
React__default.createElement("span", null)))),
|
|
90
92
|
suffix));
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
?
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
"data-testid": testID,
|
|
112
|
-
|
|
113
|
-
|
|
93
|
+
const isClickable = Boolean(onClick || onClickValue);
|
|
94
|
+
const handleClick = (ev) => {
|
|
95
|
+
onClick === null || onClick === void 0 ? void 0 : onClick(ev, ev);
|
|
96
|
+
onClickValue === null || onClickValue === void 0 ? void 0 : onClickValue(value, ev);
|
|
97
|
+
};
|
|
98
|
+
return (React__default.createElement(Tooltip, { message: tooltipMessage, setTabIndex: false }, isClickable
|
|
99
|
+
? React__default.createElement("button", Object.assign(Object.assign({}, rest), { className: classes, style, onClick: handleClick, tabIndex: disabled ? -1 : tabIndex, onKeyDown,
|
|
100
|
+
onFocus,
|
|
101
|
+
onBlur,
|
|
102
|
+
onPointerDown,
|
|
103
|
+
onPointerUp,
|
|
104
|
+
onPointerEnter,
|
|
105
|
+
onPointerLeave,
|
|
106
|
+
onMouseDown,
|
|
107
|
+
onMouseUp,
|
|
108
|
+
onMouseEnter,
|
|
109
|
+
onMouseLeave,
|
|
110
|
+
onTouchStart,
|
|
111
|
+
onTouchEnd,
|
|
112
|
+
onContextMenu, "aria-label": ariaLabel !== null && ariaLabel !== void 0 ? ariaLabel : ariaLabelProp, disabled,
|
|
113
|
+
role, "data-testid": testID !== null && testID !== void 0 ? testID : dataTestId, title, type: "button", ref }), chipContent)
|
|
114
|
+
: React__default.createElement("div", Object.assign(Object.assign({}, rest), { className: classes, style, tabIndex: disabled ? -1 : tabIndex, onKeyDown,
|
|
115
|
+
onFocus,
|
|
116
|
+
onBlur,
|
|
117
|
+
onPointerDown,
|
|
118
|
+
onPointerUp,
|
|
119
|
+
onPointerEnter,
|
|
120
|
+
onPointerLeave,
|
|
121
|
+
onMouseDown,
|
|
122
|
+
onMouseUp,
|
|
123
|
+
onMouseEnter,
|
|
124
|
+
onMouseLeave,
|
|
125
|
+
onTouchStart,
|
|
126
|
+
onTouchEnd,
|
|
127
|
+
onContextMenu, "aria-label": ariaLabel !== null && ariaLabel !== void 0 ? ariaLabel : ariaLabelProp, role, "data-testid": testID !== null && testID !== void 0 ? testID : dataTestId, title,
|
|
128
|
+
ref }), chipContent)));
|
|
114
129
|
});
|
|
115
130
|
function getTooltipMessage(labelFullyVisible, headingFullyVisible, label, heading) {
|
|
116
131
|
let message = "";
|
|
@@ -3,6 +3,7 @@
|
|
|
3
3
|
var ComboboxTrigger = require('../../../ComboboxTrigger-cjs.js');
|
|
4
4
|
require('react');
|
|
5
5
|
require('../../../Chip-cjs.js');
|
|
6
|
+
require('../../../tslib.es6-cjs.js');
|
|
6
7
|
require('classnames');
|
|
7
8
|
require('@jobber/hooks');
|
|
8
9
|
require('../../../Avatar-cjs.js');
|
|
@@ -17,7 +18,6 @@ require('../../../floating-ui.react-dom-cjs.js');
|
|
|
17
18
|
require('react-dom');
|
|
18
19
|
require('react/jsx-runtime');
|
|
19
20
|
require('framer-motion');
|
|
20
|
-
require('../../../tslib.es6-cjs.js');
|
|
21
21
|
require('../../../ComboboxProvider-cjs.js');
|
|
22
22
|
|
|
23
23
|
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
export { C as ComboboxTrigger } from '../../../ComboboxTrigger-es.js';
|
|
2
2
|
import 'react';
|
|
3
3
|
import '../../../Chip-es.js';
|
|
4
|
+
import '../../../tslib.es6-es.js';
|
|
4
5
|
import 'classnames';
|
|
5
6
|
import '@jobber/hooks';
|
|
6
7
|
import '../../../Avatar-es.js';
|
|
@@ -15,5 +16,4 @@ import '../../../floating-ui.react-dom-es.js';
|
|
|
15
16
|
import 'react-dom';
|
|
16
17
|
import 'react/jsx-runtime';
|
|
17
18
|
import 'framer-motion';
|
|
18
|
-
import '../../../tslib.es6-es.js';
|
|
19
19
|
import '../../../ComboboxProvider-es.js';
|
|
@@ -14,7 +14,7 @@ var Chip = require('./Chip-cjs.js');
|
|
|
14
14
|
require('./tslib.es6-cjs.js');
|
|
15
15
|
|
|
16
16
|
function InternalChip({ label, active = false, disabled = false, invalid = false, prefix, suffix, tabIndex, ariaLabel, onClick, onKeyDown, }) {
|
|
17
|
-
return (React.createElement(Chip.Chip, { disabled: disabled, invalid: invalid, onKeyDown: onKeyDown, testID: "ATL-InternalChip", ariaLabel: ariaLabel, tabIndex: tabIndex, variation: active ? "base" : "subtle", role: tabIndex !== undefined ? "option" : undefined, onClick: onClick
|
|
17
|
+
return (React.createElement(Chip.Chip, { disabled: disabled, invalid: invalid, onKeyDown: onKeyDown, testID: "ATL-InternalChip", ariaLabel: ariaLabel, tabIndex: tabIndex, variation: active ? "base" : "subtle", role: tabIndex !== undefined ? "option" : undefined, onClick: onClick, label: label },
|
|
18
18
|
prefix && React.createElement(Chip.Chip.Prefix, null, prefix),
|
|
19
19
|
suffix && React.createElement(Chip.Chip.Suffix, null, suffix)));
|
|
20
20
|
}
|
|
@@ -12,7 +12,7 @@ import { C as Chip, I as InternalChipButton } from './Chip-es.js';
|
|
|
12
12
|
import './tslib.es6-es.js';
|
|
13
13
|
|
|
14
14
|
function InternalChip({ label, active = false, disabled = false, invalid = false, prefix, suffix, tabIndex, ariaLabel, onClick, onKeyDown, }) {
|
|
15
|
-
return (React__default.createElement(Chip, { disabled: disabled, invalid: invalid, onKeyDown: onKeyDown, testID: "ATL-InternalChip", ariaLabel: ariaLabel, tabIndex: tabIndex, variation: active ? "base" : "subtle", role: tabIndex !== undefined ? "option" : undefined, onClick: onClick
|
|
15
|
+
return (React__default.createElement(Chip, { disabled: disabled, invalid: invalid, onKeyDown: onKeyDown, testID: "ATL-InternalChip", ariaLabel: ariaLabel, tabIndex: tabIndex, variation: active ? "base" : "subtle", role: tabIndex !== undefined ? "option" : undefined, onClick: onClick, label: label },
|
|
16
16
|
prefix && React__default.createElement(Chip.Prefix, null, prefix),
|
|
17
17
|
suffix && React__default.createElement(Chip.Suffix, null, suffix)));
|
|
18
18
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@jobber/components",
|
|
3
|
-
"version": "6.121.
|
|
3
|
+
"version": "6.121.1-JOB-161185-eeb3cdb.2+eeb3cdb6a",
|
|
4
4
|
"license": "MIT",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "dist/index.cjs",
|
|
@@ -562,5 +562,5 @@
|
|
|
562
562
|
"> 1%",
|
|
563
563
|
"IE 10"
|
|
564
564
|
],
|
|
565
|
-
"gitHead": "
|
|
565
|
+
"gitHead": "eeb3cdb6a84b13f09ab69e24a094d0e99e1b901f"
|
|
566
566
|
}
|