@jobber/components 3.5.10 → 4.0.1-pre.4

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.
Files changed (127) hide show
  1. package/dist/Autocomplete/Autocomplete.d.ts +1 -1
  2. package/dist/Autocomplete/Option.d.ts +2 -2
  3. package/dist/Autocomplete/index.js +51 -67
  4. package/dist/Avatar/Avatar.d.ts +2 -2
  5. package/dist/Avatar/index.js +2 -2
  6. package/dist/{Avatar-cfd04e86.js → Avatar-89cfd0a6.js} +14 -18
  7. package/dist/Banner/Banner.d.ts +1 -1
  8. package/dist/Banner/index.js +15 -19
  9. package/dist/Button/Button.d.ts +1 -1
  10. package/dist/Button/index.js +3 -4
  11. package/dist/{Button-cd30df0f.js → Button-16e043ec.js} +21 -24
  12. package/dist/ButtonDismiss/index.js +4 -5
  13. package/dist/{ButtonDismiss-a9590195.js → ButtonDismiss-3fb1eaf9.js} +2 -3
  14. package/dist/Card/Card.d.ts +1 -1
  15. package/dist/Card/index.js +6 -7
  16. package/dist/Card/types.d.ts +1 -1
  17. package/dist/{Card-b9f8d6f3.js → Card-edab9c3c.js} +18 -22
  18. package/dist/Checkbox/Checkbox.d.ts +1 -1
  19. package/dist/Checkbox/index.js +4 -5
  20. package/dist/{Checkbox-5103d2b9.js → Checkbox-c1efc2f6.js} +10 -12
  21. package/dist/Chips/ChipsTypes.d.ts +1 -1
  22. package/dist/Chips/InternalChipDismissible/InternalChipDismissibleTypes.d.ts +1 -1
  23. package/dist/Chips/InternalChipDismissible/hooks/useInternalChipDismissible.d.ts +1 -1
  24. package/dist/Chips/InternalChipDismissible/hooks/useInternalChipDismissibleInput.d.ts +3 -3
  25. package/dist/Chips/InternalChipMultiSelect.d.ts +1 -1
  26. package/dist/Chips/InternalChipSingleSelect.d.ts +1 -1
  27. package/dist/Chips/index.js +165 -185
  28. package/dist/ConfirmationModal/ConfirmationModal.d.ts +1 -1
  29. package/dist/ConfirmationModal/index.js +11 -12
  30. package/dist/{ConfirmationModal-e95f46d7.js → ConfirmationModal-6a7beee2.js} +28 -31
  31. package/dist/Content/index.js +1 -1
  32. package/dist/{Content-18de5fbb.js → Content-05df8f7f.js} +2 -3
  33. package/dist/Countdown/Countdown.d.ts +1 -1
  34. package/dist/Countdown/computeTimeUnit.d.ts +1 -1
  35. package/dist/Countdown/index.js +15 -18
  36. package/dist/DataDump/index.js +9 -11
  37. package/dist/DataTable/Footer.d.ts +1 -1
  38. package/dist/DataTable/createTableSettings.d.ts +2 -2
  39. package/dist/DataTable/index.js +74 -106
  40. package/dist/DataTable/test-utilities/helpers.d.ts +1 -1
  41. package/dist/DataTable/types.d.ts +2 -2
  42. package/dist/DatePicker/DatePicker.d.ts +1 -1
  43. package/dist/DatePicker/index.js +4 -5
  44. package/dist/{DatePicker-7c67e8d2.js → DatePicker-af21ae91.js} +31 -36
  45. package/dist/DescriptionList/index.js +5 -10
  46. package/dist/Disclosure/index.js +8 -10
  47. package/dist/Divider/index.js +8 -10
  48. package/dist/Drawer/index.js +10 -14
  49. package/dist/Emphasis/index.js +2 -3
  50. package/dist/{Emphasis-75a3f411.js → Emphasis-23dc2a0a.js} +4 -6
  51. package/dist/FeatureSwitch/index.js +15 -17
  52. package/dist/Form/index.js +23 -33
  53. package/dist/FormField/FormFieldTypes.d.ts +2 -2
  54. package/dist/FormField/index.js +8 -8
  55. package/dist/{FormField-76068c0b.js → FormField-1e444bb6.js} +68 -76
  56. package/dist/FormatDate/index.js +2 -3
  57. package/dist/FormatEmail/index.js +2 -3
  58. package/dist/FormatFile/index.js +13 -14
  59. package/dist/{FormatFile-18e8a54a.js → FormatFile-3512f838.js} +33 -40
  60. package/dist/FormatRelativeDateTime/index.js +5 -6
  61. package/dist/FormatTime/index.js +6 -7
  62. package/dist/Gallery/GalleryTypes.d.ts +2 -2
  63. package/dist/Gallery/index.js +31 -33
  64. package/dist/Heading/index.js +2 -3
  65. package/dist/{Heading-a9a66964.js → Heading-7b203f7f.js} +4 -6
  66. package/dist/Icon/index.js +1 -1
  67. package/dist/{Icon-d5ad1a6d.js → Icon-405a216c.js} +7 -8
  68. package/dist/InlineLabel/InlineLabel.d.ts +1 -1
  69. package/dist/InlineLabel/index.js +4 -6
  70. package/dist/InputAvatar/index.js +15 -20
  71. package/dist/InputDate/index.js +15 -15
  72. package/dist/InputEmail/InputEmail.d.ts +1 -1
  73. package/dist/InputEmail/index.js +12 -12
  74. package/dist/InputFile/index.js +6 -6
  75. package/dist/{InputFile-e108a7f8.js → InputFile-5e0ed2b5.js} +48 -62
  76. package/dist/InputGroup/index.js +4 -5
  77. package/dist/InputNumber/index.js +22 -22
  78. package/dist/InputPassword/index.js +12 -12
  79. package/dist/InputText/InputText.d.ts +1 -1
  80. package/dist/InputText/index.js +9 -9
  81. package/dist/{InputText-523d0e48.js → InputText-12b112a9.js} +23 -24
  82. package/dist/InputTime/index.js +27 -27
  83. package/dist/InputValidation/index.js +4 -5
  84. package/dist/{InputValidation-06a8a7ba.js → InputValidation-97dd0dcf.js} +7 -8
  85. package/dist/LightBox/index.js +5 -6
  86. package/dist/{LightBox-1ad62669.js → LightBox-dd1afa97.js} +22 -26
  87. package/dist/List/index.js +26 -32
  88. package/dist/Markdown/index.js +6 -7
  89. package/dist/{Markdown-b53e0308.js → Markdown-be2dcd0c.js} +12 -18
  90. package/dist/Menu/index.js +4 -5
  91. package/dist/{Menu-826cfb89.js → Menu-d6a7d17b.js} +31 -36
  92. package/dist/Modal/index.js +6 -7
  93. package/dist/{Modal-cc3bd7bf.js → Modal-757e83fd.js} +13 -17
  94. package/dist/MultiSelect/index.js +53 -60
  95. package/dist/MultiSelect/types.d.ts +1 -1
  96. package/dist/{Option-fdf21181.js → Option-13150f4a.js} +3 -5
  97. package/dist/Page/Page.d.ts +1 -1
  98. package/dist/Page/index.js +21 -24
  99. package/dist/Popover/index.js +11 -13
  100. package/dist/ProgressBar/index.js +1 -1
  101. package/dist/{ProgressBar-e9a49129.js → ProgressBar-f028b159.js} +3 -4
  102. package/dist/RadioGroup/RadioOption.d.ts +2 -2
  103. package/dist/RadioGroup/index.js +9 -13
  104. package/dist/RecurringSelect/types.d.ts +2 -2
  105. package/dist/Select/Select.d.ts +1 -1
  106. package/dist/Select/index.js +9 -9
  107. package/dist/Spinner/index.js +1 -1
  108. package/dist/{Spinner-e4e9c8eb.js → Spinner-ae4c8a85.js} +5 -7
  109. package/dist/StatusLabel/StatusLabel.d.ts +1 -1
  110. package/dist/StatusLabel/index.js +6 -9
  111. package/dist/Switch/index.js +2 -3
  112. package/dist/{Switch-f03b70fc.js → Switch-7ac32f7b.js} +12 -16
  113. package/dist/Table/index.js +9 -17
  114. package/dist/Tabs/index.js +28 -34
  115. package/dist/Text/index.js +2 -3
  116. package/dist/{Text-e012fb46.js → Text-7ce00adb.js} +4 -5
  117. package/dist/Toast/Toast.d.ts +2 -2
  118. package/dist/Toast/index.js +42 -40
  119. package/dist/Tooltip/index.js +3 -4
  120. package/dist/Tooltip/useTooltipPositioning.d.ts +1 -1
  121. package/dist/{Tooltip-041feb00.js → Tooltip-1090a43d.js} +25 -28
  122. package/dist/Typography/Typography.d.ts +1 -1
  123. package/dist/Typography/index.js +1 -2
  124. package/dist/{Typography-fbe0ed6e.js → Typography-9262511f.js} +5 -7
  125. package/dist/tslib.es6-efe27175.js +38 -0
  126. package/package.json +8 -8
  127. package/dist/tslib.es6-5b50eb8e.js +0 -103
@@ -2,7 +2,7 @@
2
2
  import { XOR } from "ts-xor";
3
3
  import { GroupOption, Option } from "./Option";
4
4
  import { FormFieldProps } from "../FormField";
5
- declare type OptionCollection = XOR<Option[], GroupOption[]>;
5
+ type OptionCollection = XOR<Option[], GroupOption[]>;
6
6
  interface AutocompleteProps extends Pick<FormFieldProps, "size" | "onBlur" | "onFocus" | "invalid"> {
7
7
  /**
8
8
  * Initial options to show when user first focuses the Autocomplete
@@ -1,5 +1,5 @@
1
1
  import { XOR } from "ts-xor";
2
- declare type OptionValue = string | number;
2
+ type OptionValue = string | number;
3
3
  interface BaseOption {
4
4
  label: string;
5
5
  }
@@ -11,5 +11,5 @@ export interface Option extends BaseOption {
11
11
  export interface GroupOption extends BaseOption {
12
12
  options: Option[];
13
13
  }
14
- export declare type AnyOption = XOR<Option, GroupOption>;
14
+ export type AnyOption = XOR<Option, GroupOption>;
15
15
  export {};
@@ -2,26 +2,26 @@
2
2
 
3
3
  Object.defineProperty(exports, '__esModule', { value: true });
4
4
 
5
- var tslib_es6 = require('../tslib.es6-5b50eb8e.js');
5
+ var tslib_es6 = require('../tslib.es6-efe27175.js');
6
6
  var React = require('react');
7
7
  var debounce = require('lodash/debounce');
8
8
  var styleInject_es = require('../style-inject.es-dcee06b6.js');
9
9
  var classnames = require('classnames');
10
10
  var useEventListener = require('@use-it/event-listener');
11
- var Text = require('../Text-e012fb46.js');
12
- var Icon = require('../Icon-d5ad1a6d.js');
13
- var Heading = require('../Heading-a9a66964.js');
14
- var InputText = require('../InputText-523d0e48.js');
15
- require('../Typography-fbe0ed6e.js');
11
+ var Text = require('../Text-7ce00adb.js');
12
+ var Icon = require('../Icon-405a216c.js');
13
+ var Heading = require('../Heading-7b203f7f.js');
14
+ var InputText = require('../InputText-12b112a9.js');
15
+ require('../Typography-9262511f.js');
16
16
  require('@jobber/design');
17
- require('../FormField-76068c0b.js');
17
+ require('../FormField-1e444bb6.js');
18
18
  require('uuid');
19
19
  require('react-hook-form');
20
- require('../Button-cd30df0f.js');
20
+ require('../Button-16e043ec.js');
21
21
  require('react-router-dom');
22
- require('../InputValidation-06a8a7ba.js');
22
+ require('../InputValidation-97dd0dcf.js');
23
23
  require('framer-motion');
24
- require('../Spinner-e4e9c8eb.js');
24
+ require('../Spinner-ae4c8a85.js');
25
25
 
26
26
  function _interopDefaultLegacy (e) { return e && typeof e === 'object' && 'default' in e ? e : { 'default': e }; }
27
27
 
@@ -39,28 +39,23 @@ var IndexChange;
39
39
  IndexChange[IndexChange["Previous"] = -1] = "Previous";
40
40
  IndexChange[IndexChange["Next"] = 1] = "Next";
41
41
  })(IndexChange || (IndexChange = {}));
42
- function Menu(_a) {
43
- var _b;
44
- var visible = _a.visible, options = _a.options, selectedOption = _a.selectedOption, onOptionSelect = _a.onOptionSelect;
45
- var _c = tslib_es6.__read(React.useState(0), 2), highlightedIndex = _c[0], setHighlightedIndex = _c[1];
46
- var optionMenuClass = classnames__default["default"](styles.options, (_b = {},
47
- _b[styles.visible] = visible,
48
- _b));
49
- var menuDiv = React.useRef();
50
- var detectSeparatorCondition = function (option) {
51
- return option.description || option.details;
52
- };
53
- var detectGroups = function (option) { return option.options; };
54
- var addSeparators = options.some(detectSeparatorCondition);
55
- var initialHighlight = options.some(detectGroups) ? 1 : 0;
42
+ function Menu({ visible, options, selectedOption, onOptionSelect, }) {
43
+ const [highlightedIndex, setHighlightedIndex] = React.useState(0);
44
+ const optionMenuClass = classnames__default["default"](styles.options, {
45
+ [styles.visible]: visible,
46
+ });
47
+ const menuDiv = React.useRef();
48
+ const detectSeparatorCondition = (option) => option.description || option.details;
49
+ const detectGroups = (option) => option.options;
50
+ const addSeparators = options.some(detectSeparatorCondition);
51
+ const initialHighlight = options.some(detectGroups) ? 1 : 0;
56
52
  setupKeyListeners();
57
- React.useEffect(function () { return setHighlightedIndex(initialHighlight); }, [options]);
58
- return (React__default["default"].createElement("div", { className: optionMenuClass, ref: menuDiv }, options.map(function (option, index) {
59
- var _a;
60
- var optionClass = classnames__default["default"](styles.option, (_a = {},
61
- _a[styles.active] = index === highlightedIndex,
62
- _a[styles.separator] = addSeparators,
63
- _a));
53
+ React.useEffect(() => setHighlightedIndex(initialHighlight), [options]);
54
+ return (React__default["default"].createElement("div", { className: optionMenuClass, ref: menuDiv }, options.map((option, index) => {
55
+ const optionClass = classnames__default["default"](styles.option, {
56
+ [styles.active]: index === highlightedIndex,
57
+ [styles.separator]: addSeparators,
58
+ });
64
59
  if (isGroup(option)) {
65
60
  return (React__default["default"].createElement("div", { key: option.label, className: styles.heading },
66
61
  React__default["default"].createElement(Heading.Heading, { level: 5 }, option.label)));
@@ -75,8 +70,8 @@ function Menu(_a) {
75
70
  React__default["default"].createElement(Text.Text, null, option.details))))));
76
71
  })));
77
72
  function setupKeyListeners() {
78
- useOnKeyDown("ArrowDown", function (event) {
79
- var indexChange = arrowKeyPress(event, IndexChange.Next);
73
+ useOnKeyDown("ArrowDown", (event) => {
74
+ const indexChange = arrowKeyPress(event, IndexChange.Next);
80
75
  if (indexChange) {
81
76
  setHighlightedIndex(Math.min(options.length - 1, highlightedIndex + indexChange));
82
77
  }
@@ -84,8 +79,8 @@ function Menu(_a) {
84
79
  scrollMenuIfItemNotInView(menuDiv.current, "down");
85
80
  }
86
81
  });
87
- useOnKeyDown("ArrowUp", function (event) {
88
- var indexChange = arrowKeyPress(event, IndexChange.Previous);
82
+ useOnKeyDown("ArrowUp", (event) => {
83
+ const indexChange = arrowKeyPress(event, IndexChange.Previous);
89
84
  if (indexChange) {
90
85
  setHighlightedIndex(Math.max(0, highlightedIndex + indexChange));
91
86
  }
@@ -94,13 +89,13 @@ function Menu(_a) {
94
89
  }
95
90
  });
96
91
  function scrollMenuIfItemNotInView(menuDivElement, direction) {
97
- var itemDiv = menuDivElement.querySelector("button." + styles.option + ":nth-child(" + (highlightedIndex + 1) + ")");
92
+ const itemDiv = menuDivElement.querySelector(`button.${styles.option}:nth-child(${highlightedIndex + 1})`);
98
93
  if (!itemDiv)
99
94
  return;
100
- var menuTop = menuDivElement.getBoundingClientRect().top;
101
- var _a = itemDiv.getBoundingClientRect(), itemTop = _a.top, itemHeight = _a.height, itemBottom = _a.bottom;
102
- var itemTrueBottom = itemBottom + itemHeight;
103
- var menuBottom = menuDivElement.getBoundingClientRect().bottom;
95
+ const menuTop = menuDivElement.getBoundingClientRect().top;
96
+ const { top: itemTop, height: itemHeight, bottom: itemBottom, } = itemDiv.getBoundingClientRect();
97
+ const itemTrueBottom = itemBottom + itemHeight;
98
+ const menuBottom = menuDivElement.getBoundingClientRect().bottom;
104
99
  if (direction == "up" && itemTop - itemHeight < menuTop) {
105
100
  menuDivElement.scrollTop -= itemHeight;
106
101
  }
@@ -108,7 +103,7 @@ function Menu(_a) {
108
103
  menuDivElement.scrollTop += itemHeight;
109
104
  }
110
105
  }
111
- useOnKeyDown("Enter", function (event) {
106
+ useOnKeyDown("Enter", (event) => {
112
107
  if (!visible)
113
108
  return;
114
109
  if (isGroup(options[highlightedIndex]))
@@ -121,7 +116,7 @@ function Menu(_a) {
121
116
  if (!visible)
122
117
  return;
123
118
  event.preventDefault();
124
- var requestedIndex = options[highlightedIndex + direction];
119
+ const requestedIndex = options[highlightedIndex + direction];
125
120
  return requestedIndex && isGroup(requestedIndex)
126
121
  ? direction + direction
127
122
  : direction;
@@ -134,8 +129,8 @@ function isOptionSelected(selectedOption, option) {
134
129
  function useOnKeyDown(keyName, handler) {
135
130
  // Pending: https://github.com/donavon/use-event-listener/pull/12
136
131
  // The types in useEventListener mistakenly require a SyntheticEvent for the passed generic.
137
- useEventListener__default["default"]("keydown", function (event) {
138
- var newEvent = event;
132
+ useEventListener__default["default"]("keydown", event => {
133
+ const newEvent = event;
139
134
  if (newEvent.key === keyName) {
140
135
  handler(newEvent);
141
136
  }
@@ -152,18 +147,17 @@ function isGroup(option) {
152
147
  * debounce functions.
153
148
  */
154
149
  // eslint-disable-next-line max-statements
155
- function Autocomplete(_a) {
156
- var _b = _a.initialOptions, initialOptions = _b === void 0 ? [] : _b, value = _a.value, _c = _a.allowFreeForm, allowFreeForm = _c === void 0 ? true : _c, _d = _a.size, size = _d === void 0 ? undefined : _d, invalid = _a.invalid, _e = _a.debounce, debounceRate = _e === void 0 ? 300 : _e, onChange = _a.onChange, getOptions = _a.getOptions, placeholder = _a.placeholder, onBlur = _a.onBlur, onFocus = _a.onFocus;
157
- var _f;
158
- var _g = tslib_es6.__read(React.useState(initialOptions), 2), options = _g[0], setOptions = _g[1];
159
- var _h = tslib_es6.__read(React.useState(false), 2), menuVisible = _h[0], setMenuVisible = _h[1];
160
- var _j = tslib_es6.__read(React.useState((_f = value === null || value === void 0 ? void 0 : value.label) !== null && _f !== void 0 ? _f : ""), 2), inputText = _j[0], setInputText = _j[1];
161
- var delayedSearch = debounce__default["default"](updateSearch, debounceRate);
162
- React.useEffect(function () {
150
+ function Autocomplete({ initialOptions = [], value, allowFreeForm = true, size = undefined, invalid, debounce: debounceRate = 300, onChange, getOptions, placeholder, onBlur, onFocus, }) {
151
+ var _a;
152
+ const [options, setOptions] = React.useState(initialOptions);
153
+ const [menuVisible, setMenuVisible] = React.useState(false);
154
+ const [inputText, setInputText] = React.useState((_a = value === null || value === void 0 ? void 0 : value.label) !== null && _a !== void 0 ? _a : "");
155
+ const delayedSearch = debounce__default["default"](updateSearch, debounceRate);
156
+ React.useEffect(() => {
163
157
  delayedSearch();
164
158
  return delayedSearch.cancel;
165
159
  }, [inputText]);
166
- React.useEffect(function () {
160
+ React.useEffect(() => {
167
161
  var _a;
168
162
  updateInput((_a = value === null || value === void 0 ? void 0 : value.label) !== null && _a !== void 0 ? _a : "");
169
163
  }, [value]);
@@ -177,20 +171,10 @@ function Autocomplete(_a) {
177
171
  }
178
172
  }
179
173
  function updateSearch() {
180
- return tslib_es6.__awaiter(this, void 0, void 0, function () {
181
- var updatedOptions, filteredOptions;
182
- return tslib_es6.__generator(this, function (_a) {
183
- switch (_a.label) {
184
- case 0: return [4 /*yield*/, getOptions(inputText)];
185
- case 1:
186
- updatedOptions = _a.sent();
187
- filteredOptions = updatedOptions.filter(function (option) {
188
- return "options" in option && option.options ? option.options.length > 0 : true;
189
- });
190
- setOptions(mapToOptions(filteredOptions));
191
- return [2 /*return*/];
192
- }
193
- });
174
+ return tslib_es6.__awaiter(this, void 0, void 0, function* () {
175
+ const updatedOptions = yield getOptions(inputText);
176
+ const filteredOptions = updatedOptions.filter((option) => "options" in option && option.options ? option.options.length > 0 : true);
177
+ setOptions(mapToOptions(filteredOptions));
194
178
  });
195
179
  }
196
180
  function handleMenuChange(chosenOption) {
@@ -1,6 +1,6 @@
1
1
  /// <reference types="react" />
2
2
  import { XOR } from "ts-xor";
3
- declare type AvatarSize = "base" | "large" | "small";
3
+ type AvatarSize = "base" | "large" | "small";
4
4
  interface AvatarFoundationProps {
5
5
  /**
6
6
  * A url for the image that will be displayed
@@ -33,6 +33,6 @@ interface AvatarWithImageProps extends AvatarFoundationProps {
33
33
  interface AvatarWithInitialsProps extends AvatarFoundationProps {
34
34
  readonly initials: string;
35
35
  }
36
- export declare type AvatarProps = XOR<AvatarWithImageProps, AvatarWithInitialsProps>;
36
+ export type AvatarProps = XOR<AvatarWithImageProps, AvatarWithInitialsProps>;
37
37
  export declare function Avatar({ imageUrl, name, initials, size, color, }: AvatarProps): JSX.Element;
38
38
  export {};
@@ -2,12 +2,12 @@
2
2
 
3
3
  Object.defineProperty(exports, '__esModule', { value: true });
4
4
 
5
- var Avatar = require('../Avatar-cfd04e86.js');
5
+ var Avatar = require('../Avatar-89cfd0a6.js');
6
6
  require('react');
7
7
  require('classnames');
8
8
  require('../style-inject.es-dcee06b6.js');
9
9
  require('color');
10
- require('../Icon-d5ad1a6d.js');
10
+ require('../Icon-405a216c.js');
11
11
  require('@jobber/design');
12
12
 
13
13
 
@@ -4,7 +4,7 @@ var React = require('react');
4
4
  var classnames = require('classnames');
5
5
  var styleInject_es = require('./style-inject.es-dcee06b6.js');
6
6
  var Color = require('color');
7
- var Icon = require('./Icon-d5ad1a6d.js');
7
+ var Icon = require('./Icon-405a216c.js');
8
8
 
9
9
  function _interopDefaultLegacy (e) { return e && typeof e === 'object' && 'default' in e ? e : { 'default': e }; }
10
10
 
@@ -40,7 +40,7 @@ function deconstructCssCustomProperty(color) {
40
40
  /**
41
41
  * Rips apart the `var(--custom-property)` into just `--custom-property`.
42
42
  */
43
- var customProperty = color
43
+ const customProperty = color
44
44
  .replace("var(", "")
45
45
  .slice(0, -1)
46
46
  .split(" ")
@@ -50,32 +50,28 @@ function deconstructCssCustomProperty(color) {
50
50
  .trim();
51
51
  }
52
52
 
53
- function Avatar(_a) {
54
- var _b;
55
- var imageUrl = _a.imageUrl, name = _a.name, initials = _a.initials, _c = _a.size, size = _c === void 0 ? "base" : _c, color = _a.color;
56
- var style = {
53
+ function Avatar({ imageUrl, name, initials, size = "base", color, }) {
54
+ const style = {
57
55
  backgroundColor: color,
58
56
  borderColor: color,
59
57
  };
60
58
  if (imageUrl) {
61
- style.backgroundImage = "url(" + imageUrl + ")";
59
+ style.backgroundImage = `url(${imageUrl})`;
62
60
  }
63
- var shouldBeDark = color == undefined || isDark(color);
64
- var className = classnames__default["default"](styles.avatar, size !== "base" && styles[size], (_b = {},
65
- _b[styles.hasBorder] = imageUrl && color,
66
- _b[styles.isDark] = shouldBeDark,
67
- _b));
61
+ const shouldBeDark = color == undefined || isDark(color);
62
+ const className = classnames__default["default"](styles.avatar, size !== "base" && styles[size], {
63
+ [styles.hasBorder]: imageUrl && color,
64
+ [styles.isDark]: shouldBeDark,
65
+ });
68
66
  return (React__default["default"].createElement("div", { className: className, style: style, role: imageUrl && "img", "aria-label": name }, !imageUrl && (React__default["default"].createElement(Initials, { initials: initials, dark: shouldBeDark, iconSize: size }))));
69
67
  }
70
- function Initials(_a) {
71
- var _b;
72
- var initials = _a.initials, _c = _a.dark, dark = _c === void 0 ? false : _c, _d = _a.iconSize, iconSize = _d === void 0 ? "base" : _d;
68
+ function Initials({ initials, dark = false, iconSize = "base", }) {
73
69
  if (!initials) {
74
70
  return (React__default["default"].createElement(Icon.Icon, { name: "person", color: dark ? "white" : "blue", size: iconSize }));
75
71
  }
76
- var className = classnames__default["default"](styles.initials, (_b = {},
77
- _b[styles.smallInitials] = initials.length > 2,
78
- _b));
72
+ const className = classnames__default["default"](styles.initials, {
73
+ [styles.smallInitials]: initials.length > 2,
74
+ });
79
75
  return React__default["default"].createElement("span", { className: className }, initials.substr(0, 3));
80
76
  }
81
77
 
@@ -1,6 +1,6 @@
1
1
  import { ReactNode } from "react";
2
2
  import { ButtonProps } from "../Button";
3
- export declare type BannerType = "notice" | "success" | "warning" | "error";
3
+ export type BannerType = "notice" | "success" | "warning" | "error";
4
4
  interface BannerProps {
5
5
  readonly children: ReactNode;
6
6
  readonly type: BannerType;
@@ -2,16 +2,15 @@
2
2
 
3
3
  Object.defineProperty(exports, '__esModule', { value: true });
4
4
 
5
- var tslib_es6 = require('../tslib.es6-5b50eb8e.js');
6
5
  var React = require('react');
7
6
  var classnames = require('classnames');
8
7
  var jobberHooks = require('@jobber/hooks');
9
8
  var styleInject_es = require('../style-inject.es-dcee06b6.js');
10
- var Icon = require('../Icon-d5ad1a6d.js');
11
- var Text = require('../Text-e012fb46.js');
12
- var Button = require('../Button-cd30df0f.js');
9
+ var Icon = require('../Icon-405a216c.js');
10
+ var Text = require('../Text-7ce00adb.js');
11
+ var Button = require('../Button-16e043ec.js');
13
12
  require('@jobber/design');
14
- require('../Typography-fbe0ed6e.js');
13
+ require('../Typography-9262511f.js');
15
14
  require('react-router-dom');
16
15
 
17
16
  function _interopDefaultLegacy (e) { return e && typeof e === 'object' && 'default' in e ? e : { 'default': e }; }
@@ -27,18 +26,16 @@ var css = ".nw7Tf4jicBNmfENtxh7tG {\n background-color: var(--color-informative
27
26
  var types = {"notice":"nw7Tf4jicBNmfENtxh7tG","success":"myY4eq0vr_r4Twz0QcBwu","warning":"eExwEf69eCfam2C6Ekk5D","error":"_1U_-uPZepxvaZPO5hh8G4O"};
28
27
  styleInject_es.styleInject(css);
29
28
 
30
- function Banner(_a) {
31
- var _b;
32
- var children = _a.children, type = _a.type, primaryAction = _a.primaryAction, _c = _a.dismissible, dismissible = _c === void 0 ? true : _c, onDismiss = _a.onDismiss;
33
- var _d = tslib_es6.__read(React.useState(true), 2), showBanner = _d[0], setShowBanner = _d[1];
34
- var bannerWidths = {
29
+ function Banner({ children, type, primaryAction, dismissible = true, onDismiss, }) {
30
+ const [showBanner, setShowBanner] = React.useState(true);
31
+ const bannerWidths = {
35
32
  small: 320,
36
33
  medium: 480,
37
34
  };
38
- var _e = tslib_es6.__read(jobberHooks.useResizeObserver({
35
+ const [bannerRef, { width: bannerWidth = bannerWidths.small }] = jobberHooks.useResizeObserver({
39
36
  widths: bannerWidths,
40
- }), 2), bannerRef = _e[0], _f = _e[1].width, bannerWidth = _f === void 0 ? bannerWidths.small : _f;
41
- var iconColors = {
37
+ });
38
+ const iconColors = {
42
39
  notice: "informative",
43
40
  success: "success",
44
41
  warning: "warning",
@@ -51,15 +48,15 @@ function Banner(_a) {
51
48
  variation: type === "notice" ? "learning" : "work",
52
49
  }, primaryAction);
53
50
  }
54
- var bannerClassNames = classnames__default["default"](styles.banner, types[type], (_b = {},
55
- _b[styles.medium] = bannerWidth >= bannerWidths.medium,
56
- _b));
51
+ const bannerClassNames = classnames__default["default"](styles.banner, types[type], {
52
+ [styles.medium]: bannerWidth >= bannerWidths.medium,
53
+ });
57
54
  return (React__default["default"].createElement(React__default["default"].Fragment, null, showBanner && (React__default["default"].createElement("div", { className: bannerClassNames, ref: bannerRef, role: type === "error" ? "alert" : "status" },
58
55
  React__default["default"].createElement("div", { className: styles.bannerContent },
59
56
  React__default["default"].createElement("div", { className: styles.bannerChildren },
60
57
  React__default["default"].createElement(BannerChildren, null, children)),
61
58
  primaryAction && (React__default["default"].createElement("div", { className: styles.bannerAction },
62
- React__default["default"].createElement(Button.Button, tslib_es6.__assign({}, primaryAction))))),
59
+ React__default["default"].createElement(Button.Button, Object.assign({}, primaryAction))))),
63
60
  dismissible && (React__default["default"].createElement("button", { className: styles.closeButton, onClick: handleClose, "aria-label": "Close this notification" },
64
61
  React__default["default"].createElement(Icon.Icon, { name: "cross", color: iconColors[type] })))))));
65
62
  function handleClose() {
@@ -67,8 +64,7 @@ function Banner(_a) {
67
64
  onDismiss && onDismiss();
68
65
  }
69
66
  }
70
- function BannerChildren(_a) {
71
- var children = _a.children;
67
+ function BannerChildren({ children }) {
72
68
  if (!children)
73
69
  return React__default["default"].createElement(React__default["default"].Fragment, null);
74
70
  if (children && typeof children === "string") {
@@ -59,6 +59,6 @@ interface SubmitButtonProps extends Omit<ButtonFoundationProps, "external" | "on
59
59
  */
60
60
  submit: boolean;
61
61
  }
62
- export declare type ButtonProps = XOR<BaseActionProps, XOR<DestructiveActionProps, SubmitActionProps>> & XOR<SubmitButtonProps, XOR<ButtonLinkProps, ButtonAnchorProps>> & XOR<ButtonIconProps, ButtonLabelProps>;
62
+ export type ButtonProps = XOR<BaseActionProps, XOR<DestructiveActionProps, SubmitActionProps>> & XOR<SubmitButtonProps, XOR<ButtonLinkProps, ButtonAnchorProps>> & XOR<ButtonIconProps, ButtonLabelProps>;
63
63
  export declare function Button(props: ButtonProps): JSX.Element;
64
64
  export {};
@@ -2,15 +2,14 @@
2
2
 
3
3
  Object.defineProperty(exports, '__esModule', { value: true });
4
4
 
5
- var Button = require('../Button-cd30df0f.js');
6
- require('../tslib.es6-5b50eb8e.js');
5
+ var Button = require('../Button-16e043ec.js');
7
6
  require('react');
8
7
  require('classnames');
9
8
  require('react-router-dom');
10
9
  require('../style-inject.es-dcee06b6.js');
11
- require('../Icon-d5ad1a6d.js');
10
+ require('../Icon-405a216c.js');
12
11
  require('@jobber/design');
13
- require('../Typography-fbe0ed6e.js');
12
+ require('../Typography-9262511f.js');
14
13
 
15
14
 
16
15
 
@@ -1,12 +1,11 @@
1
1
  'use strict';
2
2
 
3
- var tslib_es6 = require('./tslib.es6-5b50eb8e.js');
4
3
  var React = require('react');
5
4
  var classnames = require('classnames');
6
5
  var reactRouterDom = require('react-router-dom');
7
6
  var styleInject_es = require('./style-inject.es-dcee06b6.js');
8
- var Icon = require('./Icon-d5ad1a6d.js');
9
- var Typography = require('./Typography-fbe0ed6e.js');
7
+ var Icon = require('./Icon-405a216c.js');
8
+ var Typography = require('./Typography-9262511f.js');
10
9
 
11
10
  function _interopDefaultLegacy (e) { return e && typeof e === 'object' && 'default' in e ? e : { 'default': e }; }
12
11
 
@@ -18,30 +17,28 @@ var styles = {"button":"mvrsWRM8T3kCECXcDS2gd","work":"_32HTPrDFyNRObzZRUxmhK6",
18
17
  styleInject_es.styleInject(css);
19
18
 
20
19
  function Button(props) {
21
- var _a;
22
- var ariaControls = props.ariaControls, ariaHaspopup = props.ariaHaspopup, ariaExpanded = props.ariaExpanded, ariaLabel = props.ariaLabel, _b = props.disabled, disabled = _b === void 0 ? false : _b, external = props.external, fullWidth = props.fullWidth, icon = props.icon, label = props.label, iconOnRight = props.iconOnRight, id = props.id, loading = props.loading, onClick = props.onClick, onMouseDown = props.onMouseDown, _c = props.size, size = _c === void 0 ? "base" : _c, _d = props.type, type = _d === void 0 ? "primary" : _d, url = props.url, to = props.to, _e = props.variation, variation = _e === void 0 ? "work" : _e, submit = props.submit;
23
- var buttonClassNames = classnames__default["default"](styles.button, styles[size], (_a = {},
24
- _a[styles.onlyIcon] = icon && !label,
25
- _a[styles.hasIconAndLabel] = icon && label,
26
- _a[styles.iconOnRight] = iconOnRight,
27
- _a[styles[variation]] = variation,
28
- _a[styles[type]] = type,
29
- _a[styles.disabled] = disabled,
30
- _a[styles.fullWidth] = fullWidth,
31
- _a[styles.loading] = loading,
32
- _a));
33
- var buttonType = submit ? "submit" : "button";
34
- var tagProps = tslib_es6.__assign(tslib_es6.__assign(tslib_es6.__assign(tslib_es6.__assign(tslib_es6.__assign(tslib_es6.__assign({ className: buttonClassNames, disabled: disabled,
35
- id: id }, (!disabled && { href: url })), (!disabled && { onClick: onClick })), (!disabled && { onMouseDown: onMouseDown })), (external && { target: "_blank" })), (url === undefined && to === undefined && { type: buttonType })), { "aria-controls": ariaControls, "aria-haspopup": ariaHaspopup, "aria-expanded": ariaExpanded, "aria-label": ariaLabel });
36
- var buttonInternals = React__default["default"].createElement(ButtonInternals, tslib_es6.__assign({}, props));
20
+ const { ariaControls, ariaHaspopup, ariaExpanded, ariaLabel, disabled = false, external, fullWidth, icon, label, iconOnRight, id, loading, onClick, onMouseDown, size = "base", type = "primary", url, to, variation = "work", submit, } = props;
21
+ const buttonClassNames = classnames__default["default"](styles.button, styles[size], {
22
+ [styles.onlyIcon]: icon && !label,
23
+ [styles.hasIconAndLabel]: icon && label,
24
+ [styles.iconOnRight]: iconOnRight,
25
+ [styles[variation]]: variation,
26
+ [styles[type]]: type,
27
+ [styles.disabled]: disabled,
28
+ [styles.fullWidth]: fullWidth,
29
+ [styles.loading]: loading,
30
+ });
31
+ const buttonType = submit ? "submit" : "button";
32
+ const tagProps = Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign({ className: buttonClassNames, disabled,
33
+ id }, (!disabled && { href: url })), (!disabled && { onClick: onClick })), (!disabled && { onMouseDown: onMouseDown })), (external && { target: "_blank" })), (url === undefined && to === undefined && { type: buttonType })), { "aria-controls": ariaControls, "aria-haspopup": ariaHaspopup, "aria-expanded": ariaExpanded, "aria-label": ariaLabel });
34
+ const buttonInternals = React__default["default"].createElement(ButtonInternals, Object.assign({}, props));
37
35
  if (to) {
38
- return (React__default["default"].createElement(reactRouterDom.Link, tslib_es6.__assign({}, tagProps, { to: to }), buttonInternals));
36
+ return (React__default["default"].createElement(reactRouterDom.Link, Object.assign({}, tagProps, { to: to }), buttonInternals));
39
37
  }
40
- var Tag = url ? "a" : "button";
41
- return React__default["default"].createElement(Tag, tslib_es6.__assign({}, tagProps), buttonInternals);
38
+ const Tag = url ? "a" : "button";
39
+ return React__default["default"].createElement(Tag, Object.assign({}, tagProps), buttonInternals);
42
40
  }
43
- function ButtonInternals(_a) {
44
- var label = _a.label, icon = _a.icon, _b = _a.size, size = _b === void 0 ? "base" : _b;
41
+ function ButtonInternals({ label, icon, size = "base" }) {
45
42
  return (React__default["default"].createElement(React__default["default"].Fragment, null,
46
43
  icon && React__default["default"].createElement(Icon.Icon, { name: icon, size: size }),
47
44
  React__default["default"].createElement(Typography.Typography, { element: "span", fontWeight: "extraBold", fontFamily: "base", size: getTypeSizes(size) }, label)));
@@ -2,16 +2,15 @@
2
2
 
3
3
  Object.defineProperty(exports, '__esModule', { value: true });
4
4
 
5
- var ButtonDismiss = require('../ButtonDismiss-a9590195.js');
5
+ var ButtonDismiss = require('../ButtonDismiss-3fb1eaf9.js');
6
6
  require('react');
7
- require('../Button-cd30df0f.js');
8
- require('../tslib.es6-5b50eb8e.js');
7
+ require('../Button-16e043ec.js');
9
8
  require('classnames');
10
9
  require('react-router-dom');
11
10
  require('../style-inject.es-dcee06b6.js');
12
- require('../Icon-d5ad1a6d.js');
11
+ require('../Icon-405a216c.js');
13
12
  require('@jobber/design');
14
- require('../Typography-fbe0ed6e.js');
13
+ require('../Typography-9262511f.js');
15
14
 
16
15
 
17
16
 
@@ -1,14 +1,13 @@
1
1
  'use strict';
2
2
 
3
3
  var React = require('react');
4
- var Button = require('./Button-cd30df0f.js');
4
+ var Button = require('./Button-16e043ec.js');
5
5
 
6
6
  function _interopDefaultLegacy (e) { return e && typeof e === 'object' && 'default' in e ? e : { 'default': e }; }
7
7
 
8
8
  var React__default = /*#__PURE__*/_interopDefaultLegacy(React);
9
9
 
10
- function ButtonDismiss(_a) {
11
- var onClick = _a.onClick, ariaLabel = _a.ariaLabel;
10
+ function ButtonDismiss({ onClick, ariaLabel }) {
12
11
  return (React__default["default"].createElement(Button.Button, { ariaLabel: ariaLabel, icon: "remove", onClick: onClick, type: "tertiary", variation: "subtle" }));
13
12
  }
14
13
 
@@ -14,6 +14,6 @@ interface LinkCardProps extends CardProps {
14
14
  interface ClickableCardProps extends CardProps {
15
15
  onClick(event: React.MouseEvent<HTMLAnchorElement | HTMLDivElement>): void;
16
16
  }
17
- declare type CardPropOptions = XOR<CardProps, XOR<LinkCardProps, ClickableCardProps>>;
17
+ type CardPropOptions = XOR<CardProps, XOR<LinkCardProps, ClickableCardProps>>;
18
18
  export declare function Card({ accent, header, children, onClick, title, url, external, }: CardPropOptions): JSX.Element;
19
19
  export {};
@@ -2,18 +2,17 @@
2
2
 
3
3
  Object.defineProperty(exports, '__esModule', { value: true });
4
4
 
5
- var Card = require('../Card-b9f8d6f3.js');
6
- require('../tslib.es6-5b50eb8e.js');
5
+ var Card = require('../Card-edab9c3c.js');
7
6
  require('react');
8
7
  require('classnames');
9
8
  require('../style-inject.es-dcee06b6.js');
10
- require('../Heading-a9a66964.js');
11
- require('../Typography-fbe0ed6e.js');
12
- require('../Button-cd30df0f.js');
9
+ require('../Heading-7b203f7f.js');
10
+ require('../Typography-9262511f.js');
11
+ require('../Button-16e043ec.js');
13
12
  require('react-router-dom');
14
- require('../Icon-d5ad1a6d.js');
13
+ require('../Icon-405a216c.js');
15
14
  require('@jobber/design');
16
- require('../Menu-826cfb89.js');
15
+ require('../Menu-d6a7d17b.js');
17
16
  require('uuid');
18
17
  require('framer-motion');
19
18
  require('@jobber/hooks');
@@ -2,7 +2,7 @@ import { ReactElement, ReactNode } from "react";
2
2
  import colors from "./colors.css";
3
3
  import { ButtonProps } from "../Button";
4
4
  import { MenuProps } from "../Menu";
5
- export declare type ActionProps = ReactElement<Omit<ButtonProps, "size" | "fullWidth"> | MenuProps>;
5
+ export type ActionProps = ReactElement<Omit<ButtonProps, "size" | "fullWidth"> | MenuProps>;
6
6
  export interface HeaderActionProps {
7
7
  /**
8
8
  * The title of the card.