@jobber/components 2.86.0 → 2.86.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.
Files changed (269) hide show
  1. package/CHANGELOG.md +16 -0
  2. package/dist/Autocomplete/Autocomplete.d.ts +47 -47
  3. package/dist/Autocomplete/Menu.d.ts +9 -9
  4. package/dist/Autocomplete/Option.d.ts +15 -15
  5. package/dist/Autocomplete/index.d.ts +2 -2
  6. package/dist/Autocomplete/index.js +215 -211
  7. package/dist/Avatar/Avatar.d.ts +37 -37
  8. package/dist/Avatar/index.d.ts +1 -1
  9. package/dist/Avatar/index.js +7 -74
  10. package/dist/Avatar/utilities.d.ts +1 -1
  11. package/dist/Avatar-cfd04e86.js +82 -0
  12. package/dist/Banner/Banner.d.ts +19 -19
  13. package/dist/Banner/index.d.ts +1 -1
  14. package/dist/Banner/index.js +67 -65
  15. package/dist/Button/Button.d.ts +64 -64
  16. package/dist/Button/index.d.ts +1 -1
  17. package/dist/Button/index.js +9 -53
  18. package/dist/Button-5b2f1636.js +60 -0
  19. package/dist/ButtonDismiss/ButtonDismiss.d.ts +7 -7
  20. package/dist/ButtonDismiss/index.d.ts +1 -1
  21. package/dist/ButtonDismiss/index.js +10 -15
  22. package/dist/ButtonDismiss-4cde8f7c.js +15 -0
  23. package/dist/Card/Card.d.ts +31 -31
  24. package/dist/Card/CardClickable.d.ts +12 -12
  25. package/dist/Card/index.d.ts +1 -1
  26. package/dist/Card/index.js +7 -61
  27. package/dist/Card-368e01a3.js +68 -0
  28. package/dist/Checkbox/Checkbox.d.ts +52 -52
  29. package/dist/Checkbox/index.d.ts +1 -1
  30. package/dist/Checkbox/index.js +34 -32
  31. package/dist/Chips/Chip.d.ts +8 -8
  32. package/dist/Chips/ChipDismissible.d.ts +7 -7
  33. package/dist/Chips/ChipTypes.d.ts +59 -59
  34. package/dist/Chips/Chips.d.ts +2 -2
  35. package/dist/Chips/ChipsTypes.d.ts +82 -82
  36. package/dist/Chips/InternalChip.d.ts +2 -2
  37. package/dist/Chips/InternalChipAffix.d.ts +10 -10
  38. package/dist/Chips/InternalChipButton.d.ts +10 -10
  39. package/dist/Chips/InternalChipDismissible/InternalChipDismissible.d.ts +2 -2
  40. package/dist/Chips/InternalChipDismissible/InternalChipDismissibleInput.d.ts +2 -2
  41. package/dist/Chips/InternalChipDismissible/InternalChipDismissibleTypes.d.ts +13 -13
  42. package/dist/Chips/InternalChipDismissible/hooks/index.d.ts +5 -5
  43. package/dist/Chips/InternalChipDismissible/hooks/useInView.d.ts +5 -5
  44. package/dist/Chips/InternalChipDismissible/hooks/useInternalChipDismissible.d.ts +15 -15
  45. package/dist/Chips/InternalChipDismissible/hooks/useInternalChipDismissibleInput.d.ts +28 -28
  46. package/dist/Chips/InternalChipDismissible/hooks/useRepositionMenu.d.ts +16 -16
  47. package/dist/Chips/InternalChipDismissible/hooks/useScrollToActive.d.ts +2 -2
  48. package/dist/Chips/InternalChipDismissible/index.d.ts +1 -1
  49. package/dist/Chips/InternalChipMultiSelect.d.ts +4 -4
  50. package/dist/Chips/InternalChipSingleSelect.d.ts +4 -4
  51. package/dist/Chips/index.d.ts +3 -3
  52. package/dist/Chips/index.js +493 -491
  53. package/dist/Chips/utils/mdxUtils.d.ts +9 -9
  54. package/dist/ConfirmationModal/ConfirmationModal.d.ts +62 -62
  55. package/dist/ConfirmationModal/index.d.ts +1 -1
  56. package/dist/ConfirmationModal/index.js +20 -109
  57. package/dist/ConfirmationModal-b7ef110f.js +103 -0
  58. package/dist/Content/Content.d.ts +13 -13
  59. package/dist/Content/index.d.ts +1 -1
  60. package/dist/Content/index.js +5 -19
  61. package/dist/Content-18de5fbb.js +26 -0
  62. package/dist/Countdown/Countdown.d.ts +31 -31
  63. package/dist/Countdown/computeTimeUnit.d.ts +3 -3
  64. package/dist/Countdown/index.d.ts +1 -1
  65. package/dist/Countdown/index.js +63 -61
  66. package/dist/DataDump/DataDump.d.ts +20 -20
  67. package/dist/DataDump/index.d.ts +1 -1
  68. package/dist/DataDump/index.js +18 -17
  69. package/dist/DatePicker/DatePicker.d.ts +50 -50
  70. package/dist/DatePicker/DatePickerActivator.d.ts +12 -12
  71. package/dist/DatePicker/DatePickerCustomHeader.d.ts +2 -2
  72. package/dist/DatePicker/index.d.ts +1 -1
  73. package/dist/DatePicker/index.js +13 -97
  74. package/dist/DatePicker/useFocusOnSelectedDate.d.ts +5 -5
  75. package/dist/DatePicker-ad6f8630.js +103 -0
  76. package/dist/DescriptionList/DescriptionList.d.ts +10 -10
  77. package/dist/DescriptionList/index.d.ts +1 -1
  78. package/dist/DescriptionList/index.js +16 -15
  79. package/dist/Disclosure/Disclosure.d.ts +20 -20
  80. package/dist/Disclosure/index.d.ts +1 -1
  81. package/dist/Disclosure/index.js +32 -31
  82. package/dist/Divider/Divider.d.ts +16 -16
  83. package/dist/Divider/index.d.ts +1 -1
  84. package/dist/Divider/index.js +19 -17
  85. package/dist/Drawer/Drawer.d.ts +13 -13
  86. package/dist/Drawer/DrawerGrid.d.ts +6 -6
  87. package/dist/Drawer/index.d.ts +2 -2
  88. package/dist/Drawer/index.js +39 -37
  89. package/dist/Emphasis/Emphasis.d.ts +11 -11
  90. package/dist/Emphasis/index.d.ts +1 -1
  91. package/dist/Emphasis/index.js +7 -17
  92. package/dist/Emphasis-fd845639.js +21 -0
  93. package/dist/FeatureSwitch/FeatureSwitch.d.ts +51 -51
  94. package/dist/FeatureSwitch/index.d.ts +1 -1
  95. package/dist/FeatureSwitch/index.js +57 -55
  96. package/dist/Form/Form.d.ts +18 -18
  97. package/dist/Form/index.d.ts +1 -1
  98. package/dist/Form/index.js +58 -57
  99. package/dist/FormField/FormField.d.ts +2 -2
  100. package/dist/FormField/FormFieldAffix.d.ts +13 -13
  101. package/dist/FormField/FormFieldDescription.d.ts +6 -6
  102. package/dist/FormField/FormFieldPostFix.d.ts +5 -5
  103. package/dist/FormField/FormFieldTypes.d.ts +160 -160
  104. package/dist/FormField/FormFieldWrapper.d.ts +9 -9
  105. package/dist/FormField/index.d.ts +2 -2
  106. package/dist/FormField/index.js +15 -208
  107. package/dist/FormField-a92c7bac.js +213 -0
  108. package/dist/FormatDate/FormatDate.d.ts +12 -12
  109. package/dist/FormatDate/index.d.ts +1 -1
  110. package/dist/FormatDate/index.js +24 -23
  111. package/dist/FormatEmail/FormatEmail.d.ts +8 -8
  112. package/dist/FormatEmail/index.d.ts +1 -1
  113. package/dist/FormatEmail/index.js +12 -10
  114. package/dist/FormatFile/FormatFile.d.ts +30 -30
  115. package/dist/FormatFile/FormatFileDeleteButton.d.ts +6 -6
  116. package/dist/FormatFile/InternalThumbnail.d.ts +9 -9
  117. package/dist/FormatFile/index.d.ts +1 -1
  118. package/dist/FormatFile/index.js +21 -112
  119. package/dist/FormatFile-5391d4cf.js +112 -0
  120. package/dist/FormatRelativeDateTime/FormatRelativeDateTime.d.ts +11 -11
  121. package/dist/FormatRelativeDateTime/index.d.ts +1 -1
  122. package/dist/FormatRelativeDateTime/index.js +64 -63
  123. package/dist/FormatTime/FormatTime.d.ts +15 -15
  124. package/dist/FormatTime/index.d.ts +1 -1
  125. package/dist/FormatTime/index.js +28 -27
  126. package/dist/Gallery/Gallery.d.ts +2 -2
  127. package/dist/Gallery/GalleryTypes.d.ts +31 -31
  128. package/dist/Gallery/index.d.ts +1 -1
  129. package/dist/Gallery/index.js +82 -80
  130. package/dist/Heading/Heading.d.ts +14 -14
  131. package/dist/Heading/index.d.ts +1 -1
  132. package/dist/Heading/index.js +7 -53
  133. package/dist/Heading-56750113.js +57 -0
  134. package/dist/Icon/Icon.d.ts +22 -22
  135. package/dist/Icon/index.d.ts +1 -1
  136. package/dist/Icon/index.js +4 -35
  137. package/dist/Icon-d5ad1a6d.js +41 -0
  138. package/dist/InlineLabel/InlineLabel.d.ts +17 -17
  139. package/dist/InlineLabel/index.d.ts +1 -1
  140. package/dist/InlineLabel/index.js +20 -18
  141. package/dist/InputAvatar/InputAvatar.d.ts +22 -22
  142. package/dist/InputAvatar/index.d.ts +1 -1
  143. package/dist/InputAvatar/index.js +57 -56
  144. package/dist/InputDate/InputDate.d.ts +19 -19
  145. package/dist/InputDate/index.d.ts +1 -1
  146. package/dist/InputDate/index.js +34 -33
  147. package/dist/InputEmail/InputEmail.d.ts +5 -5
  148. package/dist/InputEmail/index.d.ts +1 -1
  149. package/dist/InputEmail/index.js +29 -28
  150. package/dist/InputFile/InputFile.d.ts +121 -121
  151. package/dist/InputFile/index.d.ts +1 -1
  152. package/dist/InputFile/index.js +15 -168
  153. package/dist/InputFile-b5cf90c3.js +174 -0
  154. package/dist/InputGroup/InputGroup.d.ts +11 -11
  155. package/dist/InputGroup/index.d.ts +1 -1
  156. package/dist/InputGroup/index.js +24 -22
  157. package/dist/InputNumber/InputNumber.d.ts +11 -11
  158. package/dist/InputNumber/index.d.ts +1 -1
  159. package/dist/InputNumber/index.js +52 -51
  160. package/dist/InputPassword/InputPassword.d.ts +12 -12
  161. package/dist/InputPassword/index.d.ts +1 -1
  162. package/dist/InputPassword/index.js +28 -27
  163. package/dist/InputText/InputText.d.ts +29 -29
  164. package/dist/InputText/index.d.ts +1 -1
  165. package/dist/InputText/index.js +15 -95
  166. package/dist/InputText-cb3be15c.js +91 -0
  167. package/dist/InputTime/InputTime.d.ts +2 -2
  168. package/dist/InputTime/InputTimeProps.d.ts +18 -18
  169. package/dist/InputTime/InputTimeSafari.d.ts +2 -2
  170. package/dist/InputTime/civilTimeConversions.d.ts +3 -3
  171. package/dist/InputTime/index.d.ts +1 -1
  172. package/dist/InputTime/index.js +402 -257
  173. package/dist/InputValidation/InputValidation.d.ts +8 -8
  174. package/dist/InputValidation/index.d.ts +1 -1
  175. package/dist/InputValidation/index.js +8 -24
  176. package/dist/InputValidation-24d3621a.js +28 -0
  177. package/dist/LightBox/LightBox.d.ts +37 -37
  178. package/dist/LightBox/index.d.ts +1 -1
  179. package/dist/LightBox/index.js +6 -34
  180. package/dist/LightBox-b893b656.js +42 -0
  181. package/dist/List/List.d.ts +11 -11
  182. package/dist/List/ListItem.d.ts +54 -54
  183. package/dist/List/index.d.ts +1 -1
  184. package/dist/List/index.js +76 -74
  185. package/dist/Markdown/Markdown.d.ts +17 -17
  186. package/dist/Markdown/index.d.ts +1 -1
  187. package/dist/Markdown/index.js +12 -64
  188. package/dist/Markdown-69986c49.js +68 -0
  189. package/dist/Menu/Menu.d.ts +46 -46
  190. package/dist/Menu/index.d.ts +1 -1
  191. package/dist/Menu/index.js +13 -128
  192. package/dist/Menu-6a392af6.js +134 -0
  193. package/dist/Modal/Modal.d.ts +22 -22
  194. package/dist/Modal/index.d.ts +1 -1
  195. package/dist/Modal/index.js +14 -127
  196. package/dist/Modal/useFocusTrap.d.ts +10 -10
  197. package/dist/Modal-aaaaf2df.js +132 -0
  198. package/dist/Page/Page.d.ts +59 -59
  199. package/dist/Page/index.d.ts +1 -1
  200. package/dist/Page/index.js +63 -61
  201. package/dist/Popover/Popover.d.ts +26 -26
  202. package/dist/Popover/index.d.ts +1 -1
  203. package/dist/Popover/index.js +49 -48
  204. package/dist/ProgressBar/ProgressBar.d.ts +18 -18
  205. package/dist/ProgressBar/index.d.ts +1 -1
  206. package/dist/ProgressBar/index.js +5 -22
  207. package/dist/ProgressBar-e9a49129.js +29 -0
  208. package/dist/RadioGroup/RadioGroup.d.ts +27 -27
  209. package/dist/RadioGroup/RadioOption.d.ts +34 -34
  210. package/dist/RadioGroup/index.d.ts +2 -2
  211. package/dist/RadioGroup/index.js +38 -37
  212. package/dist/RecurringSelect/CurrentRecurrenceComponent.d.ts +8 -8
  213. package/dist/RecurringSelect/RecurringSelect.d.ts +8 -8
  214. package/dist/RecurringSelect/components/DayOfMonthSelect.d.ts +8 -8
  215. package/dist/RecurringSelect/components/MonthlyDayOfWeekSelect.d.ts +8 -8
  216. package/dist/RecurringSelect/components/MonthlySelect.d.ts +8 -8
  217. package/dist/RecurringSelect/components/WeeklySelect.d.ts +8 -8
  218. package/dist/RecurringSelect/components/index.d.ts +4 -4
  219. package/dist/RecurringSelect/index.d.ts +2 -2
  220. package/dist/RecurringSelect/types.d.ts +65 -65
  221. package/dist/Select/Option.d.ts +17 -17
  222. package/dist/Select/Select.d.ts +10 -10
  223. package/dist/Select/index.d.ts +2 -2
  224. package/dist/Select/index.js +20 -19
  225. package/dist/Spinner/Spinner.d.ts +15 -15
  226. package/dist/Spinner/index.d.ts +1 -1
  227. package/dist/Spinner/index.js +5 -19
  228. package/dist/Spinner-18d3dee6.js +26 -0
  229. package/dist/StatusLabel/StatusLabel.d.ts +25 -25
  230. package/dist/StatusLabel/index.d.ts +1 -1
  231. package/dist/StatusLabel/index.js +21 -19
  232. package/dist/Switch/Switch.d.ts +14 -14
  233. package/dist/Switch/index.d.ts +1 -1
  234. package/dist/Switch/index.js +7 -53
  235. package/dist/Switch-d2bec677.js +60 -0
  236. package/dist/Table/Body.d.ts +6 -6
  237. package/dist/Table/Cells/Cell.d.ts +7 -7
  238. package/dist/Table/Cells/CellCurrency.d.ts +8 -8
  239. package/dist/Table/Cells/CellNumeric.d.ts +4 -4
  240. package/dist/Table/Footer.d.ts +6 -6
  241. package/dist/Table/Header.d.ts +6 -6
  242. package/dist/Table/Row.d.ts +6 -6
  243. package/dist/Table/Table.d.ts +6 -6
  244. package/dist/Table/index.d.ts +8 -8
  245. package/dist/Table/index.js +41 -39
  246. package/dist/Tabs/Tabs.d.ts +19 -19
  247. package/dist/Tabs/index.d.ts +1 -1
  248. package/dist/Tabs/index.js +69 -67
  249. package/dist/Text/Text.d.ts +9 -9
  250. package/dist/Text/index.d.ts +1 -1
  251. package/dist/Text/index.js +7 -29
  252. package/dist/Text-9bc093e9.js +32 -0
  253. package/dist/Toast/Toast.d.ts +17 -17
  254. package/dist/Toast/index.d.ts +1 -1
  255. package/dist/Toast/index.js +93 -93
  256. package/dist/Toast/showToast.d.ts +2 -2
  257. package/dist/Tooltip/Tooltip.d.ts +10 -10
  258. package/dist/Tooltip/index.d.ts +1 -1
  259. package/dist/Tooltip/index.js +11 -110
  260. package/dist/Tooltip/useTooltipPositioning.d.ts +18 -18
  261. package/dist/Tooltip-4396164d.js +116 -0
  262. package/dist/Typography/Typography.d.ts +38 -38
  263. package/dist/Typography/index.d.ts +1 -1
  264. package/dist/Typography/index.js +6 -57
  265. package/dist/Typography-7e542a72.js +64 -0
  266. package/dist/{chunk-17e02351.js → style-inject.es-dcee06b6.js} +0 -0
  267. package/dist/{chunk-b67af3cb.js → tslib.es6-5b50eb8e.js} +0 -0
  268. package/package.json +6 -8
  269. package/rollup.config.js +28 -3
@@ -1,11 +1,11 @@
1
- import { ReactNode } from "react";
2
- import { TypographyOptions } from "../Typography";
3
- interface EmphasisProps {
4
- variation: "bold" | "italic" | "highlight";
5
- children: ReactNode;
6
- }
7
- export interface VariationMap {
8
- [variation: string]: TypographyOptions;
9
- }
10
- export declare function Emphasis({ variation, children }: EmphasisProps): JSX.Element;
11
- export {};
1
+ import { ReactNode } from "react";
2
+ import { TypographyOptions } from "../Typography";
3
+ interface EmphasisProps {
4
+ variation: "bold" | "italic" | "highlight";
5
+ children: ReactNode;
6
+ }
7
+ export interface VariationMap {
8
+ [variation: string]: TypographyOptions;
9
+ }
10
+ export declare function Emphasis({ variation, children }: EmphasisProps): JSX.Element;
11
+ export {};
@@ -1 +1 @@
1
- export { Emphasis } from "./Emphasis";
1
+ export { Emphasis } from "./Emphasis";
@@ -2,23 +2,13 @@
2
2
 
3
3
  Object.defineProperty(exports, '__esModule', { value: true });
4
4
 
5
- function _interopDefault (ex) { return (ex && (typeof ex === 'object') && 'default' in ex) ? ex['default'] : ex; }
6
-
7
- var __chunk_1 = require('../chunk-b67af3cb.js');
8
- var React = require('react');
9
- var React__default = _interopDefault(React);
10
- require('../chunk-17e02351.js');
5
+ var Emphasis = require('../Emphasis-fd845639.js');
6
+ require('../tslib.es6-5b50eb8e.js');
7
+ require('react');
8
+ require('../Typography-7e542a72.js');
11
9
  require('classnames');
12
- var index = require('../Typography/index.js');
10
+ require('../style-inject.es-dcee06b6.js');
11
+
13
12
 
14
- function Emphasis(_a) {
15
- var variation = _a.variation, children = _a.children;
16
- var variationMap = {
17
- bold: { element: "b", fontWeight: "bold" },
18
- italic: { element: "em", emphasisType: "italic" },
19
- highlight: { element: "strong", emphasisType: "highlight" },
20
- };
21
- return React__default.createElement(index.Typography, __chunk_1.__assign({}, variationMap[variation]), children);
22
- }
23
13
 
24
- exports.Emphasis = Emphasis;
14
+ exports.Emphasis = Emphasis.Emphasis;
@@ -0,0 +1,21 @@
1
+ 'use strict';
2
+
3
+ var tslib_es6 = require('./tslib.es6-5b50eb8e.js');
4
+ var React = require('react');
5
+ var Typography = require('./Typography-7e542a72.js');
6
+
7
+ function _interopDefaultLegacy (e) { return e && typeof e === 'object' && 'default' in e ? e : { 'default': e }; }
8
+
9
+ var React__default = /*#__PURE__*/_interopDefaultLegacy(React);
10
+
11
+ function Emphasis(_a) {
12
+ var variation = _a.variation, children = _a.children;
13
+ var variationMap = {
14
+ bold: { element: "b", fontWeight: "bold" },
15
+ italic: { element: "em", emphasisType: "italic" },
16
+ highlight: { element: "strong", emphasisType: "highlight" },
17
+ };
18
+ return React__default["default"].createElement(Typography.Typography, tslib_es6.__assign({}, variationMap[variation]), children);
19
+ }
20
+
21
+ exports.Emphasis = Emphasis;
@@ -1,51 +1,51 @@
1
- import { ReactNode } from "react";
2
- interface FeatureSwitchProps {
3
- readonly children?: ReactNode | ReactNode[];
4
- /**
5
- * Feature description. This supports basic markdown node types such as
6
- * `_italic_`, `**bold**`, and `[link name](url)`
7
- */
8
- readonly description?: string;
9
- /**
10
- * Determines if the switch is disabled
11
- *
12
- * @default false
13
- */
14
- readonly disabled?: boolean;
15
- /**
16
- * Defines if the feature should be ON or OFF by default.
17
- *
18
- * @default false
19
- */
20
- readonly enabled?: boolean;
21
- /**
22
- * Defines if the links in the description should open in a new tab.
23
- *
24
- * @default false
25
- */
26
- readonly externalLink?: boolean;
27
- /**
28
- * Feature title.
29
- */
30
- readonly title?: string;
31
- /**
32
- * Determines if a save indicator should show up when the `enabled` prop
33
- * changes. This means, it would only work for controlled components.
34
- *
35
- * @default false
36
- */
37
- readonly hasSaveIndicator?: boolean;
38
- /**
39
- * Callback when interacting with the switch.
40
- *
41
- * @param newValue
42
- */
43
- onSwitch?(newValue: boolean): void;
44
- /**
45
- * Callback when clicking with the edit button. This also determines if the
46
- * edit button should show up in the UI.
47
- */
48
- onEdit?(): void;
49
- }
50
- export declare function FeatureSwitch({ children, description, disabled, enabled, externalLink, onEdit, onSwitch, hasSaveIndicator, title, }: FeatureSwitchProps): JSX.Element;
51
- export {};
1
+ import { ReactNode } from "react";
2
+ interface FeatureSwitchProps {
3
+ readonly children?: ReactNode | ReactNode[];
4
+ /**
5
+ * Feature description. This supports basic markdown node types such as
6
+ * `_italic_`, `**bold**`, and `[link name](url)`
7
+ */
8
+ readonly description?: string;
9
+ /**
10
+ * Determines if the switch is disabled
11
+ *
12
+ * @default false
13
+ */
14
+ readonly disabled?: boolean;
15
+ /**
16
+ * Defines if the feature should be ON or OFF by default.
17
+ *
18
+ * @default false
19
+ */
20
+ readonly enabled?: boolean;
21
+ /**
22
+ * Defines if the links in the description should open in a new tab.
23
+ *
24
+ * @default false
25
+ */
26
+ readonly externalLink?: boolean;
27
+ /**
28
+ * Feature title.
29
+ */
30
+ readonly title?: string;
31
+ /**
32
+ * Determines if a save indicator should show up when the `enabled` prop
33
+ * changes. This means, it would only work for controlled components.
34
+ *
35
+ * @default false
36
+ */
37
+ readonly hasSaveIndicator?: boolean;
38
+ /**
39
+ * Callback when interacting with the switch.
40
+ *
41
+ * @param newValue
42
+ */
43
+ onSwitch?(newValue: boolean): void;
44
+ /**
45
+ * Callback when clicking with the edit button. This also determines if the
46
+ * edit button should show up in the UI.
47
+ */
48
+ onEdit?(): void;
49
+ }
50
+ export declare function FeatureSwitch({ children, description, disabled, enabled, externalLink, onEdit, onSwitch, hasSaveIndicator, title, }: FeatureSwitchProps): JSX.Element;
51
+ export {};
@@ -1 +1 @@
1
- export { FeatureSwitch } from "./FeatureSwitch";
1
+ export { FeatureSwitch } from "./FeatureSwitch";
@@ -2,68 +2,70 @@
2
2
 
3
3
  Object.defineProperty(exports, '__esModule', { value: true });
4
4
 
5
- function _interopDefault (ex) { return (ex && (typeof ex === 'object') && 'default' in ex) ? ex['default'] : ex; }
6
-
7
- var __chunk_1 = require('../chunk-b67af3cb.js');
5
+ var tslib_es6 = require('../tslib.es6-5b50eb8e.js');
8
6
  var React = require('react');
9
- var React__default = _interopDefault(React);
10
- var __chunk_2 = require('../chunk-17e02351.js');
11
- var classnames = _interopDefault(require('classnames'));
12
- require('../Typography/index.js');
13
- var index$1 = require('../Text/index.js');
14
- require('@jobber/design');
15
- require('../Icon/index.js');
16
- var index$3 = require('../Heading/index.js');
17
- require('react-router-dom');
18
- var index$5 = require('../Button/index.js');
19
7
  var framerMotion = require('framer-motion');
20
- var index$2$1 = require('../Content/index.js');
8
+ var classnames = require('classnames');
9
+ var styleInject_es = require('../style-inject.es-dcee06b6.js');
10
+ var Heading = require('../Heading-56750113.js');
11
+ var Text = require('../Text-9bc093e9.js');
12
+ var Content = require('../Content-18de5fbb.js');
13
+ var Switch = require('../Switch-d2bec677.js');
14
+ var Button = require('../Button-5b2f1636.js');
15
+ var Emphasis = require('../Emphasis-fd845639.js');
16
+ var Markdown = require('../Markdown-69986c49.js');
17
+ require('../Typography-7e542a72.js');
18
+ require('react-router-dom');
19
+ require('../Icon-d5ad1a6d.js');
20
+ require('@jobber/design');
21
21
  require('react-markdown');
22
- var index$4$1 = require('../Emphasis/index.js');
23
- var index$6 = require('../Markdown/index.js');
24
- var index$4 = require('../Switch/index.js');
22
+
23
+ function _interopDefaultLegacy (e) { return e && typeof e === 'object' && 'default' in e ? e : { 'default': e }; }
24
+
25
+ var React__default = /*#__PURE__*/_interopDefaultLegacy(React);
26
+ var classnames__default = /*#__PURE__*/_interopDefaultLegacy(classnames);
25
27
 
26
28
  var css = "._2wLd_KRTNAGUWLuHUk3oW {\n display: -ms-flexbox;\n display: flex;\n}\n\n._3S4AEFcAzye_0NKuyb26Pt {\n -ms-flex: 1 1 auto;\n flex: 1 1 auto;\n -ms-flex-item-align: center;\n align-self: center;\n padding-right: var(--space-base);\n transition: opacity var(--timing-base);\n}\n\n._3fTQ2YTOZjh3z63IpmHOEX {\n -ms-flex: 0 0 auto;\n flex: 0 0 auto;\n -ms-flex-item-align: start;\n align-self: flex-start;\n position: relative;\n}\n\n.vVv_rOT7pURJPkU4rvJPE {\n position: absolute;\n top: 100%;\n width: 100%;\n margin-top: var(--space-smallest);\n text-align: center;\n}\n\n.f8zTHuP6EgBAklxGjSv1O {\n opacity: 0.5;\n}\n\n.NweVtD0555WFOwkVpskgX {\n opacity: 1;\n}\n";
27
29
  var styles = {"container":"_2wLd_KRTNAGUWLuHUk3oW","content":"_3S4AEFcAzye_0NKuyb26Pt","action":"_3fTQ2YTOZjh3z63IpmHOEX","savedIndicator":"vVv_rOT7pURJPkU4rvJPE","featureContent":"f8zTHuP6EgBAklxGjSv1O","enabled":"NweVtD0555WFOwkVpskgX"};
28
- __chunk_2.styleInject(css);
30
+ styleInject_es.styleInject(css);
29
31
 
30
- function FeatureSwitch(_a) {
31
- var children = _a.children, description = _a.description, _b = _a.disabled, disabled = _b === void 0 ? false : _b, enabled = _a.enabled, _c = _a.externalLink, externalLink = _c === void 0 ? false : _c, onEdit = _a.onEdit, onSwitch = _a.onSwitch, _d = _a.hasSaveIndicator, hasSaveIndicator = _d === void 0 ? false : _d, title = _a.title;
32
- var _e = __chunk_1.__read(React.useState(false), 2), savedIndicator = _e[0], setSavedIndicator = _e[1];
33
- var featureContentClassnames = classnames(styles.featureContent, styles.content, enabled && styles.enabled);
34
- shouldShowSavedIndicator();
35
- return (React__default.createElement(index$2$1.Content, null,
36
- React__default.createElement("div", { className: styles.container },
37
- React__default.createElement("div", { className: styles.content },
38
- React__default.createElement(index$2$1.Content, null,
39
- title && React__default.createElement(index$3.Heading, { level: 4 }, title),
40
- description && (React__default.createElement(index$1.Text, null,
41
- React__default.createElement(index$6.Markdown, { content: description, basicUsage: true, externalLink: externalLink }))))),
42
- onSwitch && (React__default.createElement("div", { className: styles.action },
43
- React__default.createElement(index$4.Switch, { value: enabled, onChange: onSwitch, ariaLabel: description, disabled: disabled }),
44
- React__default.createElement(framerMotion.AnimatePresence, null, hasSaveIndicator && savedIndicator && (React__default.createElement(framerMotion.motion.div, { className: styles.savedIndicator, initial: { y: -4, opacity: 0 }, animate: { y: 0, opacity: 1 }, exit: { y: -4, opacity: 0 }, transition: {
45
- delay: 0.2,
46
- type: "spring",
47
- damping: 20,
48
- stiffness: 300,
49
- }, onAnimationComplete: handleAnimationComplete },
50
- React__default.createElement(index$1.Text, { variation: "success" },
51
- React__default.createElement(index$4$1.Emphasis, { variation: "italic" }, "Saved")))))))),
52
- (children || onEdit) && (React__default.createElement("div", { className: styles.container },
53
- children && (React__default.createElement("div", { className: featureContentClassnames }, children)),
54
- onEdit && (React__default.createElement("div", { className: styles.action },
55
- React__default.createElement(index$5.Button, { label: "Edit", type: "tertiary", onClick: onEdit })))))));
56
- function shouldShowSavedIndicator() {
57
- // Check if the component is mounted
58
- var _a = __chunk_1.__read(React.useState(false), 2), didMount = _a[0], setDidMount = _a[1];
59
- React.useEffect(function () { return setDidMount(true); }, []);
60
- React.useEffect(function () {
61
- didMount && hasSaveIndicator && setSavedIndicator(true);
62
- }, [enabled]);
63
- }
64
- function handleAnimationComplete() {
65
- setSavedIndicator(false);
66
- }
32
+ function FeatureSwitch(_a) {
33
+ var children = _a.children, description = _a.description, _b = _a.disabled, disabled = _b === void 0 ? false : _b, enabled = _a.enabled, _c = _a.externalLink, externalLink = _c === void 0 ? false : _c, onEdit = _a.onEdit, onSwitch = _a.onSwitch, _d = _a.hasSaveIndicator, hasSaveIndicator = _d === void 0 ? false : _d, title = _a.title;
34
+ var _e = tslib_es6.__read(React.useState(false), 2), savedIndicator = _e[0], setSavedIndicator = _e[1];
35
+ var featureContentClassnames = classnames__default["default"](styles.featureContent, styles.content, enabled && styles.enabled);
36
+ shouldShowSavedIndicator();
37
+ return (React__default["default"].createElement(Content.Content, null,
38
+ React__default["default"].createElement("div", { className: styles.container },
39
+ React__default["default"].createElement("div", { className: styles.content },
40
+ React__default["default"].createElement(Content.Content, null,
41
+ title && React__default["default"].createElement(Heading.Heading, { level: 4 }, title),
42
+ description && (React__default["default"].createElement(Text.Text, null,
43
+ React__default["default"].createElement(Markdown.Markdown, { content: description, basicUsage: true, externalLink: externalLink }))))),
44
+ onSwitch && (React__default["default"].createElement("div", { className: styles.action },
45
+ React__default["default"].createElement(Switch.Switch, { value: enabled, onChange: onSwitch, ariaLabel: description, disabled: disabled }),
46
+ React__default["default"].createElement(framerMotion.AnimatePresence, null, hasSaveIndicator && savedIndicator && (React__default["default"].createElement(framerMotion.motion.div, { className: styles.savedIndicator, initial: { y: -4, opacity: 0 }, animate: { y: 0, opacity: 1 }, exit: { y: -4, opacity: 0 }, transition: {
47
+ delay: 0.2,
48
+ type: "spring",
49
+ damping: 20,
50
+ stiffness: 300,
51
+ }, onAnimationComplete: handleAnimationComplete },
52
+ React__default["default"].createElement(Text.Text, { variation: "success" },
53
+ React__default["default"].createElement(Emphasis.Emphasis, { variation: "italic" }, "Saved")))))))),
54
+ (children || onEdit) && (React__default["default"].createElement("div", { className: styles.container },
55
+ children && (React__default["default"].createElement("div", { className: featureContentClassnames }, children)),
56
+ onEdit && (React__default["default"].createElement("div", { className: styles.action },
57
+ React__default["default"].createElement(Button.Button, { label: "Edit", type: "tertiary", onClick: onEdit })))))));
58
+ function shouldShowSavedIndicator() {
59
+ // Check if the component is mounted
60
+ var _a = tslib_es6.__read(React.useState(false), 2), didMount = _a[0], setDidMount = _a[1];
61
+ React.useEffect(function () { return setDidMount(true); }, []);
62
+ React.useEffect(function () {
63
+ didMount && hasSaveIndicator && setSavedIndicator(true);
64
+ }, [enabled]);
65
+ }
66
+ function handleAnimationComplete() {
67
+ setSavedIndicator(false);
68
+ }
67
69
  }
68
70
 
69
71
  exports.FeatureSwitch = FeatureSwitch;
@@ -1,18 +1,18 @@
1
- import React, { ReactNode } from "react";
2
- export interface FormRef {
3
- submit(): void;
4
- }
5
- interface FormProps {
6
- readonly children: ReactNode;
7
- /**
8
- * Callback for when the form has been sucessfully
9
- * submitted.
10
- */
11
- onSubmit?(): void;
12
- onStateChange?(formState: {
13
- isDirty: boolean;
14
- isValid: boolean;
15
- }): void;
16
- }
17
- export declare const Form: React.ForwardRefExoticComponent<FormProps & React.RefAttributes<FormRef>>;
18
- export {};
1
+ import React, { ReactNode } from "react";
2
+ export interface FormRef {
3
+ submit(): void;
4
+ }
5
+ interface FormProps {
6
+ readonly children: ReactNode;
7
+ /**
8
+ * Callback for when the form has been sucessfully
9
+ * submitted.
10
+ */
11
+ onSubmit?(): void;
12
+ onStateChange?(formState: {
13
+ isDirty: boolean;
14
+ isValid: boolean;
15
+ }): void;
16
+ }
17
+ export declare const Form: React.ForwardRefExoticComponent<FormProps & React.RefAttributes<FormRef>>;
18
+ export {};
@@ -1 +1 @@
1
- export { Form, FormRef } from "./Form";
1
+ export { Form, FormRef } from "./Form";
@@ -2,66 +2,67 @@
2
2
 
3
3
  Object.defineProperty(exports, '__esModule', { value: true });
4
4
 
5
- function _interopDefault (ex) { return (ex && (typeof ex === 'object') && 'default' in ex) ? ex['default'] : ex; }
6
-
7
- var __chunk_1 = require('../chunk-b67af3cb.js');
5
+ var tslib_es6 = require('../tslib.es6-5b50eb8e.js');
8
6
  var React = require('react');
9
- var React__default = _interopDefault(React);
10
7
  var reactHookForm = require('react-hook-form');
11
8
 
12
- var Form = React.forwardRef(function InternalForm(_a, ref) {
13
- var _this = this;
14
- var onSubmit = _a.onSubmit, children = _a.children, onStateChange = _a.onStateChange;
15
- var methods = reactHookForm.useForm({ mode: "onTouched" });
16
- var errors = methods.errors, trigger = methods.trigger, handleSubmit = methods.handleSubmit, _b = methods.formState, isDirty = _b.isDirty, isValid = _b.isValid;
17
- React.useEffect(function () { return onStateChange && onStateChange({ isDirty: isDirty, isValid: isValid }); }, [isDirty, isValid]);
18
- React.useImperativeHandle(ref, function () { return ({
19
- /**
20
- * The `trigger()` method can also accept an array
21
- * of fields to validate. We may at some point want
22
- * to consider adding a `validate()` method to the
23
- * `Form` component.
24
- */
25
- submit: function () { return __chunk_1.__awaiter(_this, void 0, void 0, function () {
26
- var valid;
27
- return __chunk_1.__generator(this, function (_a) {
28
- switch (_a.label) {
29
- case 0: return [4 /*yield*/, trigger()];
30
- case 1:
31
- valid = _a.sent();
32
- if (valid) {
33
- submitHandler();
34
- }
35
- else {
36
- trigger();
37
- errorHandler(errors);
38
- }
39
- return [2 /*return*/];
40
- }
41
- });
42
- }); },
43
- }); });
44
- /**
45
- * If an onSubmit is not passed into a form, it will only be used
46
- * for validation. For that, we do not need to wrap it in a <form>
47
- * tag. This allows the <Form> component to be used in legacy code.
48
- */
49
- var Wrapper = onSubmit ? "form" : "div";
50
- var formProps = {
51
- onSubmit: onSubmit && handleSubmit(submitHandler, errorHandler),
52
- };
53
- return (React__default.createElement(reactHookForm.FormProvider, __chunk_1.__assign({}, methods),
54
- React__default.createElement(Wrapper, __chunk_1.__assign({}, formProps, { "data-testid": "atlantis-form" }), children)));
55
- function submitHandler() {
56
- onSubmit && onSubmit();
57
- }
58
- function errorHandler(errs) {
59
- var firstErrName = Object.keys(errs)[0];
60
- var element = document.querySelector("[name=\"" + firstErrName + "\"]");
61
- if (typeof element != undefined) {
62
- element === null || element === void 0 ? void 0 : element.focus();
63
- }
64
- }
9
+ function _interopDefaultLegacy (e) { return e && typeof e === 'object' && 'default' in e ? e : { 'default': e }; }
10
+
11
+ var React__default = /*#__PURE__*/_interopDefaultLegacy(React);
12
+
13
+ var Form = React.forwardRef(function InternalForm(_a, ref) {
14
+ var _this = this;
15
+ var onSubmit = _a.onSubmit, children = _a.children, onStateChange = _a.onStateChange;
16
+ var methods = reactHookForm.useForm({ mode: "onTouched" });
17
+ var errors = methods.errors, trigger = methods.trigger, handleSubmit = methods.handleSubmit, _b = methods.formState, isDirty = _b.isDirty, isValid = _b.isValid;
18
+ React.useEffect(function () { return onStateChange && onStateChange({ isDirty: isDirty, isValid: isValid }); }, [isDirty, isValid]);
19
+ React.useImperativeHandle(ref, function () { return ({
20
+ /**
21
+ * The `trigger()` method can also accept an array
22
+ * of fields to validate. We may at some point want
23
+ * to consider adding a `validate()` method to the
24
+ * `Form` component.
25
+ */
26
+ submit: function () { return tslib_es6.__awaiter(_this, void 0, void 0, function () {
27
+ var valid;
28
+ return tslib_es6.__generator(this, function (_a) {
29
+ switch (_a.label) {
30
+ case 0: return [4 /*yield*/, trigger()];
31
+ case 1:
32
+ valid = _a.sent();
33
+ if (valid) {
34
+ submitHandler();
35
+ }
36
+ else {
37
+ trigger();
38
+ errorHandler(errors);
39
+ }
40
+ return [2 /*return*/];
41
+ }
42
+ });
43
+ }); },
44
+ }); });
45
+ /**
46
+ * If an onSubmit is not passed into a form, it will only be used
47
+ * for validation. For that, we do not need to wrap it in a <form>
48
+ * tag. This allows the <Form> component to be used in legacy code.
49
+ */
50
+ var Wrapper = onSubmit ? "form" : "div";
51
+ var formProps = {
52
+ onSubmit: onSubmit && handleSubmit(submitHandler, errorHandler),
53
+ };
54
+ return (React__default["default"].createElement(reactHookForm.FormProvider, tslib_es6.__assign({}, methods),
55
+ React__default["default"].createElement(Wrapper, tslib_es6.__assign({}, formProps, { "data-testid": "atlantis-form" }), children)));
56
+ function submitHandler() {
57
+ onSubmit && onSubmit();
58
+ }
59
+ function errorHandler(errs) {
60
+ var firstErrName = Object.keys(errs)[0];
61
+ var element = document.querySelector("[name=\"" + firstErrName + "\"]");
62
+ if (typeof element != undefined) {
63
+ element === null || element === void 0 ? void 0 : element.focus();
64
+ }
65
+ }
65
66
  });
66
67
 
67
68
  exports.Form = Form;
@@ -1,2 +1,2 @@
1
- import { FormFieldProps } from "./FormFieldTypes";
2
- export declare function FormField(props: FormFieldProps): JSX.Element;
1
+ import { FormFieldProps } from "./FormFieldTypes";
2
+ export declare function FormField(props: FormFieldProps): JSX.Element;
@@ -1,13 +1,13 @@
1
- import { RefObject } from "react";
2
- import { XOR } from "ts-xor";
3
- import { Affix, FormFieldProps, Suffix } from "./FormFieldTypes";
4
- interface AffixLabelProps extends Affix {
5
- labelRef: RefObject<HTMLDivElement>;
6
- variation?: "prefix" | "suffix";
7
- }
8
- export declare function AffixLabel({ label, variation, labelRef, }: AffixLabelProps): JSX.Element;
9
- interface AffixIconProps extends Pick<FormFieldProps, "size"> {
10
- readonly variation?: "prefix" | "suffix";
11
- }
12
- export declare function AffixIcon({ icon, onClick, ariaLabel, variation, size, }: AffixIconProps & XOR<Affix, Suffix>): JSX.Element;
13
- export {};
1
+ import { RefObject } from "react";
2
+ import { XOR } from "ts-xor";
3
+ import { Affix, FormFieldProps, Suffix } from "./FormFieldTypes";
4
+ interface AffixLabelProps extends Affix {
5
+ labelRef: RefObject<HTMLDivElement>;
6
+ variation?: "prefix" | "suffix";
7
+ }
8
+ export declare function AffixLabel({ label, variation, labelRef, }: AffixLabelProps): JSX.Element;
9
+ interface AffixIconProps extends Pick<FormFieldProps, "size"> {
10
+ readonly variation?: "prefix" | "suffix";
11
+ }
12
+ export declare function AffixIcon({ icon, onClick, ariaLabel, variation, size, }: AffixIconProps & XOR<Affix, Suffix>): JSX.Element;
13
+ export {};
@@ -1,6 +1,6 @@
1
- interface FormFieldDescriptionProps {
2
- readonly id: string;
3
- readonly description: string;
4
- }
5
- export declare function FormFieldDescription({ id, description, }: FormFieldDescriptionProps): JSX.Element;
6
- export {};
1
+ interface FormFieldDescriptionProps {
2
+ readonly id: string;
3
+ readonly description: string;
4
+ }
5
+ export declare function FormFieldDescription({ id, description, }: FormFieldDescriptionProps): JSX.Element;
6
+ export {};
@@ -1,5 +1,5 @@
1
- interface FormFieldPostFixProps {
2
- readonly variation: "select" | "spinner";
3
- }
4
- export declare function FormFieldPostFix({ variation }: FormFieldPostFixProps): JSX.Element;
5
- export {};
1
+ interface FormFieldPostFixProps {
2
+ readonly variation: "select" | "spinner";
3
+ }
4
+ export declare function FormFieldPostFix({ variation }: FormFieldPostFixProps): JSX.Element;
5
+ export {};