@jobber/components 4.57.1 → 4.58.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.
|
@@ -5,7 +5,7 @@ import { ComboboxAction } from "./components/ComboboxAction";
|
|
|
5
5
|
import { ComboboxTriggerButton, ComboboxTriggerChip } from "./components/ComboboxTrigger";
|
|
6
6
|
import { ComboboxOption } from "./components/ComboboxOption";
|
|
7
7
|
import { ComboboxActivator } from "./components/ComboboxActivator";
|
|
8
|
-
export declare function Combobox({ multiSelect, selected, ...props }: ComboboxProps): JSX.Element;
|
|
8
|
+
export declare function Combobox({ multiSelect, label, selected, ...props }: ComboboxProps): JSX.Element;
|
|
9
9
|
export declare namespace Combobox {
|
|
10
10
|
var TriggerButton: typeof ComboboxTriggerButton;
|
|
11
11
|
var TriggerChip: typeof ComboboxTriggerChip;
|
|
@@ -10,9 +10,9 @@ export interface ComboboxProps extends Partial<Omit<ComboboxContentBaseProps, "o
|
|
|
10
10
|
*/
|
|
11
11
|
readonly multiSelect?: boolean;
|
|
12
12
|
/**
|
|
13
|
-
* The
|
|
13
|
+
* The label for the Combobox trigger
|
|
14
14
|
*/
|
|
15
|
-
readonly
|
|
15
|
+
readonly label?: string;
|
|
16
16
|
readonly onSelect?: (selection: ComboboxOption[]) => void;
|
|
17
17
|
readonly onClose?: (selection: ComboboxOption[]) => void;
|
|
18
18
|
}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
/// <reference types="react" />
|
|
2
2
|
import { ComboboxContentProps } from "../../Combobox.types";
|
|
3
3
|
interface ComboboxTriggerProps extends Pick<ComboboxContentProps, "selected"> {
|
|
4
|
-
readonly
|
|
4
|
+
readonly label: string;
|
|
5
5
|
}
|
|
6
6
|
export declare function ComboboxTrigger({ selected, ...props }: ComboboxTriggerProps): JSX.Element;
|
|
7
7
|
export {};
|
package/dist/Combobox/index.js
CHANGED
|
@@ -322,7 +322,7 @@ function ComboboxTrigger(_a) {
|
|
|
322
322
|
const hasSelection = selected.length;
|
|
323
323
|
const selectedLabel = selected.map(option => option.label).join(", ");
|
|
324
324
|
const renderHeading = multiselect || !hasSelection;
|
|
325
|
-
return (React__default["default"].createElement(Chip.Chip, { variation: hasSelection ? "base" : "subtle", label: hasSelection ? selectedLabel : "", heading: renderHeading ? props.
|
|
325
|
+
return (React__default["default"].createElement(Chip.Chip, { variation: hasSelection ? "base" : "subtle", label: hasSelection ? selectedLabel : "", heading: renderHeading ? props.label : "", onClick: () => setOpen(!open), role: "combobox" }, !hasSelection && (React__default["default"].createElement(Chip.Chip.Suffix, null,
|
|
326
326
|
React__default["default"].createElement(Icon.Icon, { name: "add", size: "small" })))));
|
|
327
327
|
}
|
|
328
328
|
|
|
@@ -393,14 +393,14 @@ function isActionElement(child) {
|
|
|
393
393
|
}
|
|
394
394
|
|
|
395
395
|
function Combobox(_a) {
|
|
396
|
-
var { multiSelect = false, selected = [] } = _a, props = tslib_es6.__rest(_a, ["multiSelect", "selected"]);
|
|
396
|
+
var { multiSelect = false, label = "Select", selected = [] } = _a, props = tslib_es6.__rest(_a, ["multiSelect", "label", "selected"]);
|
|
397
397
|
const { contentElement, triggerElement, optionElements, actionElements } = useComboboxValidation(props.children);
|
|
398
398
|
const buildOptions = optionElements.map(option => ({
|
|
399
399
|
id: option.props.id,
|
|
400
400
|
label: option.props.label,
|
|
401
401
|
}));
|
|
402
402
|
return (React__default["default"].createElement(ComboboxContextProvider, { multiselect: multiSelect },
|
|
403
|
-
triggerElement ||
|
|
403
|
+
triggerElement || React__default["default"].createElement(ComboboxTrigger, { label: label, selected: selected }),
|
|
404
404
|
contentElement || (
|
|
405
405
|
// @ts-expect-error - Suppress the XOR error with onClose|onSelect until we finish the refactor on JOB-81416
|
|
406
406
|
React__default["default"].createElement(ComboboxContent, Object.assign({ options: buildOptions, selected: selected }, props), actionElements))));
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@jobber/components",
|
|
3
|
-
"version": "4.
|
|
3
|
+
"version": "4.58.0",
|
|
4
4
|
"license": "MIT",
|
|
5
5
|
"main": "dist/index.js",
|
|
6
6
|
"types": "dist/index.d.ts",
|
|
@@ -84,5 +84,5 @@
|
|
|
84
84
|
"> 1%",
|
|
85
85
|
"IE 10"
|
|
86
86
|
],
|
|
87
|
-
"gitHead": "
|
|
87
|
+
"gitHead": "2b92aaeb02b87b7eff93e09277688164e7aaf556"
|
|
88
88
|
}
|