@jobber/components 4.46.0 → 4.46.1-JOB-79340.27
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/Chip.d.ts +1 -0
- package/Chip.js +17 -0
- package/dist/Autocomplete/index.js +7 -7
- package/dist/Avatar/Avatar.d.ts +1 -1
- package/dist/Avatar/index.d.ts +1 -1
- package/dist/Banner/index.js +3 -3
- package/dist/Button/index.js +2 -2
- package/dist/{Button-d89f2271.js → Button-db6114a6.js} +1 -1
- package/dist/ButtonDismiss/index.js +3 -3
- package/dist/{ButtonDismiss-250840a4.js → ButtonDismiss-1ccb84ec.js} +1 -1
- package/dist/Card/index.js +5 -5
- package/dist/{Card-69304e99.js → Card-116af709.js} +3 -3
- package/dist/Checkbox/index.js +3 -3
- package/dist/{Checkbox-eac63b7f.js → Checkbox-bc4bc968.js} +1 -1
- package/dist/Chip/Chip.d.ts +8 -0
- package/dist/Chip/Chip.types.d.d.ts +64 -0
- package/dist/Chip/components/ChipDismissible/ChipDismissible.d.ts +3 -0
- package/dist/Chip/components/ChipPrefix/Chip.Prefix.d.ts +6 -0
- package/dist/Chip/components/ChipSelectable/ChipSelectable.d.ts +3 -0
- package/dist/Chip/components/ChipSuffix/Chip.Suffix.d.ts +7 -0
- package/dist/Chip/hooks/index.d.ts +1 -0
- package/dist/Chip/hooks/useChildComponent.d.ts +8 -0
- package/dist/Chip/index.d.ts +4 -0
- package/dist/Chip/index.js +28 -0
- package/dist/ChipSelectable-8e5509a1.js +74 -0
- package/dist/Chips/ChipsTypes.d.ts +12 -8
- package/dist/Chips/InternalChipDismissible/InternalChipDismissible.d.ts +2 -2
- package/dist/Chips/InternalChipDismissible/InternalChipDismissibleTypes.d.ts +1 -1
- package/dist/Chips/InternalChipDismissible/hooks/useInternalChipDismissible.d.ts +1 -1
- package/dist/Chips/InternalChipMultiSelect.d.ts +1 -1
- package/dist/Chips/InternalChipSingleSelect.d.ts +2 -2
- package/dist/Chips/index.d.ts +5 -1
- package/dist/Chips/index.js +24 -10
- package/dist/{Chip-4d8e6370.js → Chips-2daf43ea.js} +84 -78
- package/dist/Combobox/components/ComboboxContent/ComboboxContent.d.ts +17 -6
- package/dist/Combobox/components/ComboboxContent/ComboboxList.d.ts +9 -8
- package/dist/Combobox/components/ComboboxContent/ComboboxSearch.d.ts +4 -4
- package/dist/Combobox/hooks/useComboboxContent.d.ts +7 -3
- package/dist/Combobox/index.js +61 -28
- package/dist/ConfirmationModal/index.js +9 -9
- package/dist/{ConfirmationModal-92f07027.js → ConfirmationModal-285c3cbe.js} +2 -2
- package/dist/DataDump/index.js +6 -6
- package/dist/DataList/DataList.types.d.ts +9 -1
- package/dist/DataList/components/DataListSearch/DataListSearch.d.ts +1 -1
- package/dist/DataList/index.js +47 -24
- package/dist/DataTable/index.js +6 -6
- package/dist/DatePicker/index.js +3 -3
- package/dist/{DatePicker-39d2dc8b.js → DatePicker-49213434.js} +2 -2
- package/dist/DescriptionList/index.js +1 -1
- package/dist/Disclosure/index.js +1 -1
- package/dist/Drawer/index.js +4 -4
- package/dist/Emphasis/index.js +2 -2
- package/dist/{Emphasis-cc3456ac.js → Emphasis-e10dde65.js} +1 -1
- package/dist/FeatureSwitch/index.js +7 -7
- package/dist/FormField/index.js +5 -5
- package/dist/{FormField-bef41ec9.js → FormField-fa9254dc.js} +3 -3
- package/dist/FormatFile/index.js +10 -10
- package/dist/{FormatFile-a470c0f2.js → FormatFile-6423c3b5.js} +4 -4
- package/dist/Gallery/index.js +11 -11
- package/dist/Heading/index.js +2 -2
- package/dist/{Heading-4562900a.js → Heading-4cde9989.js} +1 -1
- package/dist/InlineLabel/index.js +2 -2
- package/dist/{InlineLabel-3d461632.js → InlineLabel-a24706c4.js} +1 -1
- package/dist/InputAvatar/index.js +3 -3
- package/dist/InputDate/index.js +6 -6
- package/dist/InputEmail/index.js +5 -5
- package/dist/InputFile/index.js +3 -3
- package/dist/{InputFile-d327dee3.js → InputFile-25c3369b.js} +2 -2
- package/dist/InputNumber/index.js +6 -6
- package/dist/{InputNumber-5640fb55.js → InputNumber-ea9fcee1.js} +1 -1
- package/dist/InputPassword/index.js +5 -5
- package/dist/InputPhoneNumber/index.js +5 -5
- package/dist/InputText/index.js +6 -6
- package/dist/{InputText-5ac5cfe0.js → InputText-ab237501.js} +1 -1
- package/dist/InputTime/index.js +5 -5
- package/dist/InputValidation/index.js +3 -3
- package/dist/{InputValidation-4e809bdd.js → InputValidation-377d6c62.js} +1 -1
- package/dist/LightBox/index.js +4 -4
- package/dist/{LightBox-02ca409e.js → LightBox-93ef99b9.js} +2 -2
- package/dist/List/index.js +5 -5
- package/dist/Markdown/index.js +5 -5
- package/dist/{Markdown-b37cf9ec.js → Markdown-d53b01bf.js} +3 -3
- package/dist/Menu/index.js +3 -3
- package/dist/{Menu-cec53b50.js → Menu-2e64307a.js} +2 -2
- package/dist/Modal/index.js +5 -5
- package/dist/{Modal-dcdc0032.js → Modal-c17cc105.js} +3 -3
- package/dist/MultiSelect/index.js +3 -3
- package/dist/{Option-9f4a65da.js → Option-07a24acd.js} +1 -1
- package/dist/Page/index.js +7 -7
- package/dist/Popover/index.js +4 -4
- package/dist/{Popover-d401fb54.js → Popover-7c966790.js} +1 -1
- package/dist/RadioGroup/index.js +3 -3
- package/dist/{RadioGroup-46833fac.js → RadioGroup-9bdd8a59.js} +1 -1
- package/dist/RecurringSelect/index.js +8 -8
- package/dist/Select/index.js +6 -6
- package/dist/StatusLabel/index.js +2 -2
- package/dist/Switch/index.js +2 -2
- package/dist/{Switch-165f01e3.js → Switch-cc9b645c.js} +1 -1
- package/dist/Tabs/index.js +1 -1
- package/dist/Text/index.js +2 -2
- package/dist/{Text-59bde58c.js → Text-54334431.js} +1 -1
- package/dist/Toast/index.js +2 -2
- package/dist/Tooltip/index.js +3 -3
- package/dist/{Tooltip-59dbab5b.js → Tooltip-d5257798.js} +1 -1
- package/dist/Typography/index.js +1 -1
- package/dist/{Typography-9bff9c91.js → Typography-83915c54.js} +2 -2
- package/package.json +5 -5
package/Chip.d.ts
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from "./dist/Chip";
|
package/Chip.js
ADDED
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true,
|
|
5
|
+
});
|
|
6
|
+
|
|
7
|
+
var Chip = require("./dist/Chip");
|
|
8
|
+
|
|
9
|
+
Object.keys(Chip).forEach(function(key) {
|
|
10
|
+
if (key === "default" || key === "__esModule") return;
|
|
11
|
+
Object.defineProperty(exports, key, {
|
|
12
|
+
enumerable: true,
|
|
13
|
+
get: function get() {
|
|
14
|
+
return Chip[key];
|
|
15
|
+
},
|
|
16
|
+
});
|
|
17
|
+
});
|
|
@@ -10,18 +10,18 @@ var classnames = require('classnames');
|
|
|
10
10
|
var useEventListener = require('@use-it/event-listener');
|
|
11
11
|
var ReactDOM = require('react-dom');
|
|
12
12
|
var reactPopper = require('react-popper');
|
|
13
|
-
var Text = require('../Text-
|
|
13
|
+
var Text = require('../Text-54334431.js');
|
|
14
14
|
var Icon = require('../Icon-405a216c.js');
|
|
15
|
-
var Heading = require('../Heading-
|
|
16
|
-
var InputText = require('../InputText-
|
|
17
|
-
require('../Typography-
|
|
15
|
+
var Heading = require('../Heading-4cde9989.js');
|
|
16
|
+
var InputText = require('../InputText-ab237501.js');
|
|
17
|
+
require('../Typography-83915c54.js');
|
|
18
18
|
require('@jobber/design');
|
|
19
|
-
require('../FormField-
|
|
19
|
+
require('../FormField-fa9254dc.js');
|
|
20
20
|
require('uuid');
|
|
21
21
|
require('react-hook-form');
|
|
22
|
-
require('../Button-
|
|
22
|
+
require('../Button-db6114a6.js');
|
|
23
23
|
require('react-router-dom');
|
|
24
|
-
require('../InputValidation-
|
|
24
|
+
require('../InputValidation-377d6c62.js');
|
|
25
25
|
require('framer-motion');
|
|
26
26
|
require('../Spinner-9d8fc7ff.js');
|
|
27
27
|
|
package/dist/Avatar/Avatar.d.ts
CHANGED
package/dist/Avatar/index.d.ts
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
export { Avatar, AvatarProps } from "./Avatar";
|
|
1
|
+
export { Avatar, AvatarProps, AvatarSize } from "./Avatar";
|
package/dist/Banner/index.js
CHANGED
|
@@ -7,10 +7,10 @@ var classnames = require('classnames');
|
|
|
7
7
|
var jobberHooks = require('@jobber/hooks/useResizeObserver');
|
|
8
8
|
var styleInject_es = require('../style-inject.es-9d2f5f4e.js');
|
|
9
9
|
var Icon = require('../Icon-405a216c.js');
|
|
10
|
-
var Text = require('../Text-
|
|
11
|
-
var Button = require('../Button-
|
|
10
|
+
var Text = require('../Text-54334431.js');
|
|
11
|
+
var Button = require('../Button-db6114a6.js');
|
|
12
12
|
require('@jobber/design');
|
|
13
|
-
require('../Typography-
|
|
13
|
+
require('../Typography-83915c54.js');
|
|
14
14
|
require('react-router-dom');
|
|
15
15
|
|
|
16
16
|
function _interopDefaultLegacy (e) { return e && typeof e === 'object' && 'default' in e ? e : { 'default': e }; }
|
package/dist/Button/index.js
CHANGED
|
@@ -2,14 +2,14 @@
|
|
|
2
2
|
|
|
3
3
|
Object.defineProperty(exports, '__esModule', { value: true });
|
|
4
4
|
|
|
5
|
-
var Button = require('../Button-
|
|
5
|
+
var Button = require('../Button-db6114a6.js');
|
|
6
6
|
require('react');
|
|
7
7
|
require('classnames');
|
|
8
8
|
require('react-router-dom');
|
|
9
9
|
require('../style-inject.es-9d2f5f4e.js');
|
|
10
10
|
require('../Icon-405a216c.js');
|
|
11
11
|
require('@jobber/design');
|
|
12
|
-
require('../Typography-
|
|
12
|
+
require('../Typography-83915c54.js');
|
|
13
13
|
|
|
14
14
|
|
|
15
15
|
|
|
@@ -5,7 +5,7 @@ var classnames = require('classnames');
|
|
|
5
5
|
var reactRouterDom = require('react-router-dom');
|
|
6
6
|
var styleInject_es = require('./style-inject.es-9d2f5f4e.js');
|
|
7
7
|
var Icon = require('./Icon-405a216c.js');
|
|
8
|
-
var Typography = require('./Typography-
|
|
8
|
+
var Typography = require('./Typography-83915c54.js');
|
|
9
9
|
|
|
10
10
|
function _interopDefaultLegacy (e) { return e && typeof e === 'object' && 'default' in e ? e : { 'default': e }; }
|
|
11
11
|
|
|
@@ -2,15 +2,15 @@
|
|
|
2
2
|
|
|
3
3
|
Object.defineProperty(exports, '__esModule', { value: true });
|
|
4
4
|
|
|
5
|
-
var ButtonDismiss = require('../ButtonDismiss-
|
|
5
|
+
var ButtonDismiss = require('../ButtonDismiss-1ccb84ec.js');
|
|
6
6
|
require('react');
|
|
7
|
-
require('../Button-
|
|
7
|
+
require('../Button-db6114a6.js');
|
|
8
8
|
require('classnames');
|
|
9
9
|
require('react-router-dom');
|
|
10
10
|
require('../style-inject.es-9d2f5f4e.js');
|
|
11
11
|
require('../Icon-405a216c.js');
|
|
12
12
|
require('@jobber/design');
|
|
13
|
-
require('../Typography-
|
|
13
|
+
require('../Typography-83915c54.js');
|
|
14
14
|
|
|
15
15
|
|
|
16
16
|
|
package/dist/Card/index.js
CHANGED
|
@@ -2,17 +2,17 @@
|
|
|
2
2
|
|
|
3
3
|
Object.defineProperty(exports, '__esModule', { value: true });
|
|
4
4
|
|
|
5
|
-
var Card = require('../Card-
|
|
5
|
+
var Card = require('../Card-116af709.js');
|
|
6
6
|
require('react');
|
|
7
7
|
require('classnames');
|
|
8
8
|
require('../style-inject.es-9d2f5f4e.js');
|
|
9
|
-
require('../Heading-
|
|
10
|
-
require('../Typography-
|
|
11
|
-
require('../Button-
|
|
9
|
+
require('../Heading-4cde9989.js');
|
|
10
|
+
require('../Typography-83915c54.js');
|
|
11
|
+
require('../Button-db6114a6.js');
|
|
12
12
|
require('react-router-dom');
|
|
13
13
|
require('../Icon-405a216c.js');
|
|
14
14
|
require('@jobber/design');
|
|
15
|
-
require('../Menu-
|
|
15
|
+
require('../Menu-2e64307a.js');
|
|
16
16
|
require('uuid');
|
|
17
17
|
require('framer-motion');
|
|
18
18
|
require('@jobber/hooks/useOnKeyDown');
|
|
@@ -3,9 +3,9 @@
|
|
|
3
3
|
var React = require('react');
|
|
4
4
|
var classnames = require('classnames');
|
|
5
5
|
var styleInject_es = require('./style-inject.es-9d2f5f4e.js');
|
|
6
|
-
var Heading = require('./Heading-
|
|
7
|
-
var Button = require('./Button-
|
|
8
|
-
var Menu = require('./Menu-
|
|
6
|
+
var Heading = require('./Heading-4cde9989.js');
|
|
7
|
+
var Button = require('./Button-db6114a6.js');
|
|
8
|
+
var Menu = require('./Menu-2e64307a.js');
|
|
9
9
|
|
|
10
10
|
function _interopDefaultLegacy (e) { return e && typeof e === 'object' && 'default' in e ? e : { 'default': e }; }
|
|
11
11
|
|
package/dist/Checkbox/index.js
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
|
|
3
3
|
Object.defineProperty(exports, '__esModule', { value: true });
|
|
4
4
|
|
|
5
|
-
var Checkbox = require('../Checkbox-
|
|
5
|
+
var Checkbox = require('../Checkbox-bc4bc968.js');
|
|
6
6
|
require('../tslib.es6-5b8768b7.js');
|
|
7
7
|
require('react');
|
|
8
8
|
require('uuid');
|
|
@@ -11,8 +11,8 @@ require('react-hook-form');
|
|
|
11
11
|
require('../style-inject.es-9d2f5f4e.js');
|
|
12
12
|
require('../Icon-405a216c.js');
|
|
13
13
|
require('@jobber/design');
|
|
14
|
-
require('../Text-
|
|
15
|
-
require('../Typography-
|
|
14
|
+
require('../Text-54334431.js');
|
|
15
|
+
require('../Typography-83915c54.js');
|
|
16
16
|
|
|
17
17
|
|
|
18
18
|
|
|
@@ -7,7 +7,7 @@ var classnames = require('classnames');
|
|
|
7
7
|
var reactHookForm = require('react-hook-form');
|
|
8
8
|
var styleInject_es = require('./style-inject.es-9d2f5f4e.js');
|
|
9
9
|
var Icon = require('./Icon-405a216c.js');
|
|
10
|
-
var Text = require('./Text-
|
|
10
|
+
var Text = require('./Text-54334431.js');
|
|
11
11
|
|
|
12
12
|
function _interopDefaultLegacy (e) { return e && typeof e === 'object' && 'default' in e ? e : { 'default': e }; }
|
|
13
13
|
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import { ChipPrefix } from "./components/ChipPrefix/Chip.Prefix";
|
|
2
|
+
import { ChipSuffix } from "./components/ChipSuffix/Chip.Suffix";
|
|
3
|
+
import { ChipProps } from "./Chip.types.d";
|
|
4
|
+
export declare const Chip: {
|
|
5
|
+
({ ariaLabel, dataTestID, disabled, heading, invalid, label, value, onClick, onKeyDown, children, role, tabIndex, variation, }: ChipProps): JSX.Element;
|
|
6
|
+
Prefix: typeof ChipPrefix;
|
|
7
|
+
Suffix: typeof ChipSuffix;
|
|
8
|
+
};
|
|
@@ -0,0 +1,64 @@
|
|
|
1
|
+
import React, { PropsWithChildren } from "react";
|
|
2
|
+
export interface ChipProps extends PropsWithChildren {
|
|
3
|
+
/**
|
|
4
|
+
* Accessible label, which can be different from the primary label.
|
|
5
|
+
*/
|
|
6
|
+
readonly ariaLabel?: string;
|
|
7
|
+
/**
|
|
8
|
+
* Enables pass through of a data-testid. This is legacy functionality to allow old tests to pass.
|
|
9
|
+
*/
|
|
10
|
+
readonly dataTestID?: string;
|
|
11
|
+
/**
|
|
12
|
+
* Disables both mouse and keyboard functionality, and updates the visual style of the Chip to appear disabled.
|
|
13
|
+
*/
|
|
14
|
+
readonly disabled?: boolean;
|
|
15
|
+
/**
|
|
16
|
+
* Adds more prominent text to act as a heading. Will be displayed on the left with a | separator.
|
|
17
|
+
*/
|
|
18
|
+
readonly heading?: string;
|
|
19
|
+
/**
|
|
20
|
+
* Changes Chip styling to inform the user of an issue.
|
|
21
|
+
*/
|
|
22
|
+
readonly invalid?: boolean;
|
|
23
|
+
/**
|
|
24
|
+
* The content of the chip. Will be displayed on the right if you include a heading.
|
|
25
|
+
*/
|
|
26
|
+
readonly label: string;
|
|
27
|
+
/**
|
|
28
|
+
* The accessible role the Chip is fulfilling. Defaults to 'button'
|
|
29
|
+
*/
|
|
30
|
+
readonly role?: string;
|
|
31
|
+
/**
|
|
32
|
+
* Used for accessibility purpopses, specifically using the tab key as navigation.
|
|
33
|
+
* @default 0
|
|
34
|
+
*/
|
|
35
|
+
readonly tabIndex?: number;
|
|
36
|
+
/**
|
|
37
|
+
* Will be passed to onClick, when the user clicks on this Chip.
|
|
38
|
+
*/
|
|
39
|
+
readonly value?: string | number;
|
|
40
|
+
/**
|
|
41
|
+
* Button style variation. Does not affect functionality.
|
|
42
|
+
* @default "base"
|
|
43
|
+
*/
|
|
44
|
+
readonly variation?: ChipVariations;
|
|
45
|
+
/**
|
|
46
|
+
* Chip Click Callback. Sends an event and sometimes a value (SelectableChip).
|
|
47
|
+
*/
|
|
48
|
+
readonly onClick?: (value: string | number | undefined, ev: React.MouseEvent<HTMLButtonElement>) => void;
|
|
49
|
+
/**
|
|
50
|
+
* Callback. Called when you keydown on Chip. Ships the event, so you can get the key pushed.
|
|
51
|
+
*/
|
|
52
|
+
readonly onKeyDown?: (ev: React.KeyboardEvent<HTMLButtonElement>) => void;
|
|
53
|
+
}
|
|
54
|
+
export type ChipVariations = "subtle" | "base";
|
|
55
|
+
export interface ChipSelectableProps extends ChipProps {
|
|
56
|
+
/**
|
|
57
|
+
* Is Chip selected?
|
|
58
|
+
*/
|
|
59
|
+
readonly selected?: boolean;
|
|
60
|
+
/**
|
|
61
|
+
* Send this back onClick. Good for determining which Chip was clicked.
|
|
62
|
+
*/
|
|
63
|
+
readonly value?: string | number;
|
|
64
|
+
}
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import { PropsWithChildren } from "react";
|
|
2
|
+
export declare function ChipSuffix({ children, className, showBG }: ChipSuffixProps): JSX.Element;
|
|
3
|
+
export interface ChipSuffixProps extends PropsWithChildren {
|
|
4
|
+
readonly className?: string;
|
|
5
|
+
readonly showBG?: boolean;
|
|
6
|
+
}
|
|
7
|
+
export declare const allowedSuffixIcons: string[];
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from "./useChildComponent";
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import { ReactNode } from "react";
|
|
2
|
+
/**
|
|
3
|
+
* Returns the first React Child that receives `true` from isCorrectComponent
|
|
4
|
+
* @param children React Children
|
|
5
|
+
* @param isCorrectComponent a function that accepts a JSX Element and returns a boolean.
|
|
6
|
+
* @returns The first child component that returns true on isCorrectComponent
|
|
7
|
+
*/
|
|
8
|
+
export declare function useChildComponent(children: ReactNode | undefined, isCorrectComponent: (toCheck: JSX.Element) => boolean): JSX.Element | undefined;
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, '__esModule', { value: true });
|
|
4
|
+
|
|
5
|
+
var ChipSelectable = require('../ChipSelectable-8e5509a1.js');
|
|
6
|
+
var React = require('react');
|
|
7
|
+
var Icon = require('../Icon-405a216c.js');
|
|
8
|
+
require('../tslib.es6-5b8768b7.js');
|
|
9
|
+
require('classnames');
|
|
10
|
+
require('../style-inject.es-9d2f5f4e.js');
|
|
11
|
+
require('../Avatar-1aa30ee1.js');
|
|
12
|
+
require('color');
|
|
13
|
+
require('../Typography-83915c54.js');
|
|
14
|
+
require('@jobber/design');
|
|
15
|
+
|
|
16
|
+
function _interopDefaultLegacy (e) { return e && typeof e === 'object' && 'default' in e ? e : { 'default': e }; }
|
|
17
|
+
|
|
18
|
+
var React__default = /*#__PURE__*/_interopDefaultLegacy(React);
|
|
19
|
+
|
|
20
|
+
function ChipDismissible(props) {
|
|
21
|
+
return (React__default["default"].createElement(ChipSelectable.Chip, Object.assign({}, props),
|
|
22
|
+
React__default["default"].createElement(ChipSelectable.Chip.Suffix, null,
|
|
23
|
+
React__default["default"].createElement(Icon.Icon, { name: "cross", size: "small", color: "blue" }))));
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
exports.Chip = ChipSelectable.Chip;
|
|
27
|
+
exports.ChipSelectable = ChipSelectable.ChipSelectable;
|
|
28
|
+
exports.ChipDismissible = ChipDismissible;
|
|
@@ -0,0 +1,74 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
var tslib_es6 = require('./tslib.es6-5b8768b7.js');
|
|
4
|
+
var React = require('react');
|
|
5
|
+
var Icon = require('./Icon-405a216c.js');
|
|
6
|
+
var classnames = require('classnames');
|
|
7
|
+
var styleInject_es = require('./style-inject.es-9d2f5f4e.js');
|
|
8
|
+
var Avatar = require('./Avatar-1aa30ee1.js');
|
|
9
|
+
var Typography = require('./Typography-83915c54.js');
|
|
10
|
+
|
|
11
|
+
function _interopDefaultLegacy (e) { return e && typeof e === 'object' && 'default' in e ? e : { 'default': e }; }
|
|
12
|
+
|
|
13
|
+
var React__default = /*#__PURE__*/_interopDefaultLegacy(React);
|
|
14
|
+
var classnames__default = /*#__PURE__*/_interopDefaultLegacy(classnames);
|
|
15
|
+
|
|
16
|
+
var css_248z = ".af7U8MvcbHE- {\n --chip-height: 40px;\n --chip-radius: 20px;\n --chip-disabled--bg: var(--color-grey--lighter);\n --chip-bar-color: var(--color-greyBlue--light);\n --chip-base-bg: var(--color-greyBlue--lightest);\n --chip-base--hover: var(--color-greyBlue--lighter);\n display: -ms-flexbox;\n display: flex;\n position: relative;\n height: 40px;\n height: var(--chip-height);\n padding: calc(16px / 2) 16px;\n padding: var(--space-small) var(--base-unit);\n border: calc(16px / 16) solid transparent;\n border: var(--border-base) solid transparent;\n border-radius: 20px;\n border-radius: var(--chip-radius);\n color: rgb(1, 41, 57);\n color: var(--color-heading);\n text-align: left;\n cursor: pointer;\n transition: all var(--ease-both) 100ms;\n transition: all var(--ease-both) var(--timing-quick);\n -ms-flex-align: center;\n align-items: center;\n}\n\n.af7U8MvcbHE-:focus {\n box-shadow: 0px 0px calc(16px / 4) calc(16px / 8)\n rgb(231, 213, 87);\n box-shadow: var(--shadow-focus);\n}\n\n.af7U8MvcbHE- .e905AYK4SCc- {\n margin-left: calc(-1 * (16px / 2));\n margin-left: calc(-1 * calc(16px / 2));\n margin-left: calc(-1 * var(--space-small));\n margin-right: calc(16px / 2);\n margin-right: var(--space-small);\n}\n\n.af7U8MvcbHE- .ySADfZ0FckM- {\n margin-left: calc(16px / 2);\n margin-left: var(--space-small);\n margin-right: calc(-1 * (16px / 2));\n margin-right: calc(-1 * calc(16px / 2));\n margin-right: calc(-1 * var(--space-small));\n}\n\n.af7U8MvcbHE- .e905AYK4SCc-,\n.af7U8MvcbHE- .ySADfZ0FckM- {\n display: -ms-flexbox;\n display: flex;\n width: calc(16px * 1.5);\n width: var(--space-large);\n height: calc(16px * 1.5);\n height: var(--space-large);\n -ms-flex-negative: 0;\n flex-shrink: 0;\n border-radius: 100%;\n border-radius: var(--radius-circle);\n background-color: rgba(255, 255, 255, 1);\n background-color: var(--color-surface);\n -ms-flex-align: center;\n align-items: center;\n -ms-flex-pack: center;\n justify-content: center;\n}\n\n.af7U8MvcbHE- .ySADfZ0FckM-:hover,\n.af7U8MvcbHE- .e905AYK4SCc-:hover {\n background-color: rgb(181, 181, 181);\n background-color: var(--color-disabled);\n}\n\n.af7U8MvcbHE- .e905AYK4SCc-.usdkmQ9Sxbk-,\n.af7U8MvcbHE- .ySADfZ0FckM-.usdkmQ9Sxbk- {\n display: none;\n}\n\n.af7U8MvcbHE- .dg1-Izy1eQA- {\n width: calc(16px / 16);\n width: var(--space-minuscule);\n height: 16px;\n height: var(--base-unit);\n margin: 0 calc(16px / 2);\n margin: 0 var(--space-small);\n background-color: var(--chip-bar-color);\n}\n\n.af7U8MvcbHE- .-lz0EYLTDgg- {\n border-radius: 100%;\n border-radius: var(--radius-circle);\n background-color: rgba(255, 255, 255, 1);\n background-color: var(--color-surface);\n}\n\n.wSI5L-5rODg- {\n border: calc(16px / 16) solid transparent;\n border: var(--border-base) solid transparent;\n color: rgb(1, 41, 57);\n color: var(--color-heading);\n background-color: var(--chip-base-bg);\n}\n\n.wSI5L-5rODg-:hover,\n.wSI5L-5rODg-:focus {\n background-color: var(--chip-base--hover);\n}\n\n.SmUxkzpIC84-,\n.SmUxkzpIC84-:hover,\n.SmUxkzpIC84-:focus,\n.Mux23dmZSuw-.SmUxkzpIC84-,\n.Mux23dmZSuw-.SmUxkzpIC84-:hover,\n.Mux23dmZSuw-.SmUxkzpIC84-:focus {\n border: calc(16px / 16) solid rgb(201, 66, 33);\n border: var(--border-base) solid var(--color-critical);\n background-color: rgb(255, 226, 219);\n background-color: var(--color-critical--surface);\n}\n\n.Mux23dmZSuw- {\n border: calc(16px / 16) solid rgb(225, 225, 225);\n border: var(--border-base) solid var(--color-disabled--secondary);\n background-color: rgba(255, 255, 255, 1);\n background-color: var(--color-surface);\n}\n\n.Mux23dmZSuw-:hover {\n border: calc(16px / 16) solid var(--chip-base-bg);\n border: var(--border-base) solid var(--chip-base-bg);\n background-color: var(--chip-base-bg);\n}\n\n.MbRItb9vKhc-,\n.MbRItb9vKhc-:hover,\n.MbRItb9vKhc-:focus {\n border: calc(16px / 16) solid var(--chip-disabled--bg);\n border: var(--border-base) solid var(--chip-disabled--bg);\n color: rgb(181, 181, 181);\n color: var(--color-disabled);\n background-color: var(--chip-disabled--bg);\n cursor: auto;\n}\n\n.MbRItb9vKhc- .dg1-Izy1eQA- {\n background-color: rgb(181, 181, 181);\n background-color: var(--color-disabled);\n}\n\n.af7U8MvcbHE-.MbRItb9vKhc- .ySADfZ0FckM- {\n background-color: rgb(181, 181, 181);\n background-color: var(--color-disabled);\n}\n";
|
|
17
|
+
var styles = {"chip":"af7U8MvcbHE-","prefix":"e905AYK4SCc-","suffix":"ySADfZ0FckM-","empty":"usdkmQ9Sxbk-","chipBar":"dg1-Izy1eQA-","selected":"-lz0EYLTDgg-","base":"wSI5L-5rODg-","invalid":"SmUxkzpIC84-","subtle":"Mux23dmZSuw-","disabled":"MbRItb9vKhc-"};
|
|
18
|
+
styleInject_es.styleInject(css_248z);
|
|
19
|
+
|
|
20
|
+
/**
|
|
21
|
+
* Returns the first React Child that receives `true` from isCorrectComponent
|
|
22
|
+
* @param children React Children
|
|
23
|
+
* @param isCorrectComponent a function that accepts a JSX Element and returns a boolean.
|
|
24
|
+
* @returns The first child component that returns true on isCorrectComponent
|
|
25
|
+
*/
|
|
26
|
+
function useChildComponent(children, isCorrectComponent) {
|
|
27
|
+
return React.useMemo(() => {
|
|
28
|
+
return React__default["default"].Children.toArray(children).find(d => React.isValidElement(d) && isCorrectComponent(d));
|
|
29
|
+
}, [children]);
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
function ChipPrefix({ children, showBG }) {
|
|
33
|
+
const singleChild = useChildComponent(children, d => d.type === Avatar.Avatar || d.type === Icon.Icon);
|
|
34
|
+
return (React__default["default"].createElement("span", { className: classnames__default["default"](styles.prefix, !singleChild && styles.empty, showBG) }, singleChild));
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
function ChipSuffix({ children, className, showBG }) {
|
|
38
|
+
var _a;
|
|
39
|
+
let singleChild = useChildComponent(children, d => d.type === Icon.Icon);
|
|
40
|
+
if (!allowedSuffixIcons.includes((_a = singleChild === null || singleChild === void 0 ? void 0 : singleChild.props) === null || _a === void 0 ? void 0 : _a.name)) {
|
|
41
|
+
singleChild = undefined;
|
|
42
|
+
}
|
|
43
|
+
return (React__default["default"].createElement("span", { className: classnames__default["default"](styles.suffix, className, !singleChild && styles.empty, showBG) }, singleChild));
|
|
44
|
+
}
|
|
45
|
+
const allowedSuffixIcons = ["cross", "add", "checkmark"];
|
|
46
|
+
|
|
47
|
+
const Chip = ({ ariaLabel, dataTestID, disabled, heading, invalid, label, value, onClick, onKeyDown, children, role = "button", tabIndex = 0, variation = "base", }) => {
|
|
48
|
+
const classes = classnames__default["default"](styles.chip, {
|
|
49
|
+
[styles.invalid]: invalid,
|
|
50
|
+
[styles.base]: variation === "base",
|
|
51
|
+
[styles.subtle]: variation === "subtle",
|
|
52
|
+
[styles.disabled]: disabled,
|
|
53
|
+
});
|
|
54
|
+
const prefix = useChildComponent(children, d => d.type === Chip.Prefix);
|
|
55
|
+
const suffix = useChildComponent(children, d => d.type === Chip.Suffix);
|
|
56
|
+
return (React__default["default"].createElement("button", { className: classes, onClick: (ev) => onClick && onClick(value || label, ev), tabIndex: tabIndex, onKeyDown: onKeyDown, "aria-label": ariaLabel || label, disabled: disabled, role: role, type: "button", "data-testid": dataTestID || "chip-wrapper" },
|
|
57
|
+
prefix,
|
|
58
|
+
React__default["default"].createElement(Typography.Typography, { size: "base", fontWeight: "medium" }, heading),
|
|
59
|
+
heading && React__default["default"].createElement("span", { className: styles.chipBar }),
|
|
60
|
+
React__default["default"].createElement(Typography.Typography, { size: "base" }, label),
|
|
61
|
+
suffix));
|
|
62
|
+
};
|
|
63
|
+
Chip.Prefix = ChipPrefix;
|
|
64
|
+
Chip.Suffix = ChipSuffix;
|
|
65
|
+
|
|
66
|
+
function ChipSelectable(_a) {
|
|
67
|
+
var { selected } = _a, rest = tslib_es6.__rest(_a, ["selected"]);
|
|
68
|
+
return (React__default["default"].createElement(Chip, Object.assign({}, rest),
|
|
69
|
+
React__default["default"].createElement(Chip.Suffix, { className: selected ? styles.selected : "", showBG: true },
|
|
70
|
+
React__default["default"].createElement(Icon.Icon, { name: selected ? "checkmark" : "add", size: "small", color: selected ? "green" : "blue" }))));
|
|
71
|
+
}
|
|
72
|
+
|
|
73
|
+
exports.Chip = Chip;
|
|
74
|
+
exports.ChipSelectable = ChipSelectable;
|
|
@@ -2,7 +2,7 @@ import { MouseEvent, ReactElement } from "react";
|
|
|
2
2
|
import { XOR } from "ts-xor";
|
|
3
3
|
import { ChipProps } from "./Chip";
|
|
4
4
|
interface ChipFoundationProps {
|
|
5
|
-
readonly children
|
|
5
|
+
readonly children?: ReactElement<ChipProps>[];
|
|
6
6
|
/**
|
|
7
7
|
* Change the interaction on the chip.
|
|
8
8
|
*/
|
|
@@ -29,7 +29,7 @@ interface ChipFoundationProps {
|
|
|
29
29
|
export interface ChipSingleSelectProps extends ChipFoundationProps {
|
|
30
30
|
readonly type?: "singleselect";
|
|
31
31
|
readonly selected?: string;
|
|
32
|
-
onChange(value?: string): void;
|
|
32
|
+
onChange(value?: string | Array<string>): void;
|
|
33
33
|
/**
|
|
34
34
|
* The Chip's radio input name.
|
|
35
35
|
*
|
|
@@ -38,18 +38,22 @@ export interface ChipSingleSelectProps extends ChipFoundationProps {
|
|
|
38
38
|
readonly name?: string;
|
|
39
39
|
}
|
|
40
40
|
export interface ChipMultiSelectProps extends ChipFoundationProps {
|
|
41
|
-
readonly type
|
|
42
|
-
readonly selected
|
|
41
|
+
readonly type?: "multiselect";
|
|
42
|
+
readonly selected?: string[];
|
|
43
43
|
onChange(value: string[]): void;
|
|
44
44
|
}
|
|
45
45
|
export interface ChipDismissibleProps extends ChipFoundationProps {
|
|
46
|
-
readonly type
|
|
47
|
-
readonly selected
|
|
46
|
+
readonly type?: "dismissible";
|
|
47
|
+
readonly selected?: string[];
|
|
48
48
|
onChange(value: string[]): void;
|
|
49
49
|
/**
|
|
50
|
-
*
|
|
50
|
+
* Element that triggers opening the ChipDismissible Menu
|
|
51
51
|
*/
|
|
52
|
-
|
|
52
|
+
activator?: ReactElement;
|
|
53
|
+
/**
|
|
54
|
+
* Enables pass through of a data-testid. This is legacy functionality to allow old tests to pass.
|
|
55
|
+
*/
|
|
56
|
+
dataTestId?: string;
|
|
53
57
|
/**
|
|
54
58
|
* Adds a loading indicator
|
|
55
59
|
*/
|
|
@@ -1,3 +1,3 @@
|
|
|
1
1
|
/// <reference types="react" />
|
|
2
|
-
import {
|
|
3
|
-
export declare function InternalChipDismissible(props:
|
|
2
|
+
import { ChipDismissibleProps } from "../ChipsTypes";
|
|
3
|
+
export declare function InternalChipDismissible(props: ChipDismissibleProps): JSX.Element;
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
import { ChipProps } from "../Chip";
|
|
3
3
|
import { ChipDismissibleProps } from "../ChipsTypes";
|
|
4
4
|
export type InternalChipDismissibleProps = Omit<ChipDismissibleProps, "type">;
|
|
5
|
-
export interface ChipDismissibleInputProps extends Pick<
|
|
5
|
+
export interface ChipDismissibleInputProps extends Pick<ChipDismissibleProps, "isLoadingMore" | "onSearch" | "onLoadMore" | "type" | "activator"> {
|
|
6
6
|
readonly attachTo: React.RefObject<Element | null>;
|
|
7
7
|
readonly options: ChipProps[];
|
|
8
8
|
onCustomOptionSelect?(value: string): void;
|
|
@@ -3,7 +3,7 @@ import { InternalChipDismissibleProps } from "../InternalChipDismissibleTypes";
|
|
|
3
3
|
export declare function useInternalChipDismissible({ children, selected, onChange, onClick, onCustomAdd, }: InternalChipDismissibleProps): {
|
|
4
4
|
ref: import("react").RefObject<HTMLDivElement>;
|
|
5
5
|
sortedVisibleChipOptions: import("../../Chip").ChipProps[];
|
|
6
|
-
availableChipOptions: import("../../Chip").ChipProps[];
|
|
6
|
+
availableChipOptions: import("../../Chip").ChipProps[] | undefined;
|
|
7
7
|
handleChipRemove: (value: string) => () => void;
|
|
8
8
|
handleChipAdd: (value: string) => void;
|
|
9
9
|
handleCustomAdd: ((value: string) => void) | undefined;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/// <reference types="react" />
|
|
2
2
|
import { ChipMultiSelectProps } from "./ChipsTypes";
|
|
3
|
-
type InternalChipChoiceMultipleProps = Pick<ChipMultiSelectProps, "selected" | "onChange" | "children" | "onClick">;
|
|
3
|
+
type InternalChipChoiceMultipleProps = Pick<ChipMultiSelectProps, "selected" | "onChange" | "children" | "onClick" | "type">;
|
|
4
4
|
export declare function InternalChipMultiSelect({ children, selected, onChange, onClick, }: InternalChipChoiceMultipleProps): JSX.Element;
|
|
5
5
|
export {};
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/// <reference types="react" />
|
|
2
2
|
import { ChipSingleSelectProps } from "./ChipsTypes";
|
|
3
|
-
type InternalChipChoiceProps = Pick<ChipSingleSelectProps, "selected" | "onChange" | "children" | "onClick" | "name">;
|
|
4
|
-
export declare function InternalChipSingleSelect({ children, selected,
|
|
3
|
+
type InternalChipChoiceProps = Pick<ChipSingleSelectProps, "selected" | "onChange" | "children" | "onClick" | "name" | "type">;
|
|
4
|
+
export declare function InternalChipSingleSelect({ children, selected, onChange, onClick, }: InternalChipChoiceProps): JSX.Element;
|
|
5
5
|
export {};
|
package/dist/Chips/index.d.ts
CHANGED
|
@@ -1,3 +1,7 @@
|
|
|
1
|
-
export { ChipDismissible } from "./ChipDismissible";
|
|
2
1
|
export { Chips } from "./Chips";
|
|
3
2
|
export { Chip } from "./Chip";
|
|
3
|
+
export * from "./ChipDismissible";
|
|
4
|
+
export { InternalChipSingleSelect } from "./InternalChipSingleSelect";
|
|
5
|
+
export { InternalChipMultiSelect } from "./InternalChipMultiSelect";
|
|
6
|
+
export { InternalChipDismissible } from "./InternalChipDismissible";
|
|
7
|
+
export * from "./ChipsTypes";
|
package/dist/Chips/index.js
CHANGED
|
@@ -2,26 +2,28 @@
|
|
|
2
2
|
|
|
3
3
|
Object.defineProperty(exports, '__esModule', { value: true });
|
|
4
4
|
|
|
5
|
+
var Chips = require('../Chips-2daf43ea.js');
|
|
5
6
|
var React = require('react');
|
|
6
|
-
var
|
|
7
|
-
require('uuid');
|
|
7
|
+
var useAssert = require('@jobber/hooks/useAssert');
|
|
8
8
|
require('../style-inject.es-9d2f5f4e.js');
|
|
9
9
|
require('classnames');
|
|
10
|
-
require('@jobber/hooks/useAssert');
|
|
11
10
|
require('../Icon-405a216c.js');
|
|
12
11
|
require('@jobber/design');
|
|
13
12
|
require('../Avatar-1aa30ee1.js');
|
|
14
13
|
require('color');
|
|
15
|
-
require('../Typography-
|
|
16
|
-
require('../Tooltip-
|
|
14
|
+
require('../Typography-83915c54.js');
|
|
15
|
+
require('../Tooltip-d5257798.js');
|
|
17
16
|
require('react-dom');
|
|
18
17
|
require('framer-motion');
|
|
19
18
|
require('react-popper');
|
|
20
|
-
require('../Text-
|
|
19
|
+
require('../Text-54334431.js');
|
|
20
|
+
require('../ChipSelectable-8e5509a1.js');
|
|
21
|
+
require('../tslib.es6-5b8768b7.js');
|
|
21
22
|
require('lodash/sortBy');
|
|
22
23
|
require('@jobber/hooks/useLiveAnnounce');
|
|
24
|
+
require('uuid');
|
|
23
25
|
require('lodash/debounce');
|
|
24
|
-
require('../Button-
|
|
26
|
+
require('../Button-db6114a6.js');
|
|
25
27
|
require('react-router-dom');
|
|
26
28
|
require('../Spinner-9d8fc7ff.js');
|
|
27
29
|
|
|
@@ -29,10 +31,22 @@ function _interopDefaultLegacy (e) { return e && typeof e === 'object' && 'defau
|
|
|
29
31
|
|
|
30
32
|
var React__default = /*#__PURE__*/_interopDefaultLegacy(React);
|
|
31
33
|
|
|
34
|
+
// Only need the component to pass in the data as a react children
|
|
35
|
+
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
|
36
|
+
function Chip(props) {
|
|
37
|
+
// Throw error when <Chip /> gets used outside of the <Chips />
|
|
38
|
+
useAssert.useAssert(true, "`<Chip>` component can only be used inside `<Chips>`");
|
|
39
|
+
// eslint-disable-next-line react/jsx-no-useless-fragment
|
|
40
|
+
return React__default["default"].createElement(React__default["default"].Fragment, null);
|
|
41
|
+
}
|
|
42
|
+
|
|
32
43
|
function ChipDismissible({ label, disabled, invalid, prefix, onClick, onRequestRemove, }) {
|
|
33
|
-
return (React__default["default"].createElement(
|
|
44
|
+
return (React__default["default"].createElement(Chips.InternalChip, { label: label, disabled: disabled, invalid: invalid, prefix: prefix, onClick: onClick, suffix: React__default["default"].createElement(Chips.InternalChipButton, { icon: "remove", label: label, invalid: invalid, disabled: disabled, onClick: onRequestRemove }) }));
|
|
34
45
|
}
|
|
35
46
|
|
|
36
|
-
exports.
|
|
37
|
-
exports.
|
|
47
|
+
exports.Chips = Chips.Chips;
|
|
48
|
+
exports.InternalChipDismissible = Chips.InternalChipDismissible;
|
|
49
|
+
exports.InternalChipMultiSelect = Chips.InternalChipMultiSelect;
|
|
50
|
+
exports.InternalChipSingleSelect = Chips.InternalChipSingleSelect;
|
|
51
|
+
exports.Chip = Chip;
|
|
38
52
|
exports.ChipDismissible = ChipDismissible;
|