@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
@@ -2,39 +2,40 @@
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
- require('../chunk-17e02351.js');
11
- require('classnames');
12
- require('../Typography/index.js');
13
- require('../Text/index.js');
14
- require('@jobber/design');
15
- require('../Icon/index.js');
7
+ var FormField = require('../FormField-a92c7bac.js');
16
8
  require('uuid');
17
9
  require('react-hook-form');
18
- var index$4 = require('../FormField/index.js');
10
+ require('../style-inject.es-dcee06b6.js');
11
+ require('classnames');
12
+ require('../Button-5b2f1636.js');
19
13
  require('react-router-dom');
20
- require('../Button/index.js');
14
+ require('../Icon-d5ad1a6d.js');
15
+ require('@jobber/design');
16
+ require('../Typography-7e542a72.js');
17
+ require('../Text-9bc093e9.js');
18
+ require('../InputValidation-24d3621a.js');
21
19
  require('framer-motion');
22
- require('../InputValidation/index.js');
23
- require('../Spinner/index.js');
20
+ require('../Spinner-18d3dee6.js');
21
+
22
+ function _interopDefaultLegacy (e) { return e && typeof e === 'object' && 'default' in e ? e : { 'default': e }; }
23
+
24
+ var React__default = /*#__PURE__*/_interopDefaultLegacy(React);
24
25
 
25
- function InputPassword(props) {
26
- var _a = props.hasVisibility, hasVisibility = _a === void 0 ? false : _a;
27
- var _b = __chunk_1.__read(React.useState(false), 2), visible = _b[0], setVisibility = _b[1];
28
- return (React__default.createElement(index$4.FormField, __chunk_1.__assign({}, props, (hasVisibility && {
29
- suffix: {
30
- ariaLabel: visible ? "Hide password" : "Show password",
31
- icon: visible ? "eye" : "eyeCrossed",
32
- onClick: function () { return setVisibility(!visible); },
33
- },
34
- }), { type: visible ? "text" : "password", onChange: handleChange })));
35
- function handleChange(newValue) {
36
- props.onChange && props.onChange(newValue);
37
- }
26
+ function InputPassword(props) {
27
+ var _a = props.hasVisibility, hasVisibility = _a === void 0 ? false : _a;
28
+ var _b = tslib_es6.__read(React.useState(false), 2), visible = _b[0], setVisibility = _b[1];
29
+ return (React__default["default"].createElement(FormField.FormField, tslib_es6.__assign({}, props, (hasVisibility && {
30
+ suffix: {
31
+ ariaLabel: visible ? "Hide password" : "Show password",
32
+ icon: visible ? "eye" : "eyeCrossed",
33
+ onClick: function () { return setVisibility(!visible); },
34
+ },
35
+ }), { type: visible ? "text" : "password", onChange: handleChange })));
36
+ function handleChange(newValue) {
37
+ props.onChange && props.onChange(newValue);
38
+ }
38
39
  }
39
40
 
40
41
  exports.InputPassword = InputPassword;
@@ -1,29 +1,29 @@
1
- import React from "react";
2
- import { CommonFormFieldProps, FormFieldProps } from "../FormField";
3
- interface RowRange {
4
- min: number;
5
- max: number;
6
- }
7
- interface BaseProps extends CommonFormFieldProps, Pick<FormFieldProps, "maxLength" | "readonly" | "autocomplete" | "keyboard" | "onEnter" | "onFocus" | "onBlur" | "onChange" | "inputRef" | "validations" | "defaultValue" | "prefix" | "suffix"> {
8
- multiline?: boolean;
9
- }
10
- export interface InputTextRef {
11
- insert(text: string): void;
12
- blur(): void;
13
- focus(): void;
14
- }
15
- interface MultilineProps extends BaseProps {
16
- /**
17
- * Use this when you're expecting a long answer.
18
- */
19
- readonly multiline: true;
20
- /**
21
- * Specifies the visible height of a long answer form field. Can be in the
22
- * form of a single number to set a static height, or an object with a min
23
- * and max keys indicating the minimum number of visible rows, and the
24
- * maximum number of visible rows.
25
- */
26
- readonly rows?: number | RowRange;
27
- }
28
- export declare const InputText: React.ForwardRefExoticComponent<(import("ts-xor/dist/types/Without.type").Without<BaseProps, MultilineProps> & MultilineProps & React.RefAttributes<InputTextRef>) | (import("ts-xor/dist/types/Without.type").Without<MultilineProps, BaseProps> & BaseProps & React.RefAttributes<InputTextRef>)>;
29
- export {};
1
+ import React from "react";
2
+ import { CommonFormFieldProps, FormFieldProps } from "../FormField";
3
+ interface RowRange {
4
+ min: number;
5
+ max: number;
6
+ }
7
+ interface BaseProps extends CommonFormFieldProps, Pick<FormFieldProps, "maxLength" | "readonly" | "autocomplete" | "keyboard" | "onEnter" | "onFocus" | "onBlur" | "onChange" | "inputRef" | "validations" | "defaultValue" | "prefix" | "suffix"> {
8
+ multiline?: boolean;
9
+ }
10
+ export interface InputTextRef {
11
+ insert(text: string): void;
12
+ blur(): void;
13
+ focus(): void;
14
+ }
15
+ interface MultilineProps extends BaseProps {
16
+ /**
17
+ * Use this when you're expecting a long answer.
18
+ */
19
+ readonly multiline: true;
20
+ /**
21
+ * Specifies the visible height of a long answer form field. Can be in the
22
+ * form of a single number to set a static height, or an object with a min
23
+ * and max keys indicating the minimum number of visible rows, and the
24
+ * maximum number of visible rows.
25
+ */
26
+ readonly rows?: number | RowRange;
27
+ }
28
+ export declare const InputText: React.ForwardRefExoticComponent<(import("ts-xor/dist/types/Without.type").Without<BaseProps, MultilineProps> & MultilineProps & React.RefAttributes<InputTextRef>) | (import("ts-xor/dist/types/Without.type").Without<MultilineProps, BaseProps> & BaseProps & React.RefAttributes<InputTextRef>)>;
29
+ export {};
@@ -1 +1 @@
1
- export { InputText, InputTextRef } from "./InputText";
1
+ export { InputText, InputTextRef } from "./InputText";
@@ -2,104 +2,24 @@
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');
11
- require('classnames');
12
- require('../Typography/index.js');
13
- require('../Text/index.js');
14
- require('@jobber/design');
15
- require('../Icon/index.js');
5
+ var InputText = require('../InputText-cb3be15c.js');
6
+ require('../tslib.es6-5b50eb8e.js');
7
+ require('react');
8
+ require('../FormField-a92c7bac.js');
16
9
  require('uuid');
17
10
  require('react-hook-form');
18
- var index$4 = require('../FormField/index.js');
11
+ require('../style-inject.es-dcee06b6.js');
12
+ require('classnames');
13
+ require('../Button-5b2f1636.js');
19
14
  require('react-router-dom');
20
- require('../Button/index.js');
15
+ require('../Icon-d5ad1a6d.js');
16
+ require('@jobber/design');
17
+ require('../Typography-7e542a72.js');
18
+ require('../Text-9bc093e9.js');
19
+ require('../InputValidation-24d3621a.js');
21
20
  require('framer-motion');
22
- require('../InputValidation/index.js');
23
- require('../Spinner/index.js');
21
+ require('../Spinner-18d3dee6.js');
22
+
24
23
 
25
- function InputTextInternal(props, ref) {
26
- var inputRef = React.createRef();
27
- var actionsRef = React.createRef();
28
- var rowRange = getRowRange();
29
- React.useImperativeHandle(ref, function () { return ({
30
- insert: function (text) {
31
- insertText(text);
32
- },
33
- blur: function () {
34
- var input = inputRef.current;
35
- if (input) {
36
- input.blur();
37
- }
38
- },
39
- focus: function () {
40
- var input = inputRef.current;
41
- if (input) {
42
- input.focus();
43
- }
44
- },
45
- }); });
46
- return (React__default.createElement(index$4.FormField, __chunk_1.__assign({}, props, { type: props.multiline ? "textarea" : "text", inputRef: inputRef, actionsRef: actionsRef, onChange: handleChange, rows: rowRange.min })));
47
- function handleChange(newValue) {
48
- props.onChange && props.onChange(newValue);
49
- if (inputRef && inputRef.current instanceof HTMLTextAreaElement) {
50
- resize(inputRef.current);
51
- }
52
- }
53
- function getRowRange() {
54
- if (props.rows === undefined) {
55
- return { min: 3, max: 3 };
56
- }
57
- else if (typeof props.rows === "object") {
58
- return { min: props.rows.min, max: props.rows.max };
59
- }
60
- else {
61
- return { min: props.rows, max: props.rows };
62
- }
63
- }
64
- function resize(textArea) {
65
- if (rowRange.min === rowRange.max)
66
- return;
67
- textArea.style.height = "auto";
68
- textArea.style.height = textAreaHeight(textArea) + "px";
69
- }
70
- function textAreaHeight(textArea) {
71
- var _a = window.getComputedStyle(textArea), lineHeight = _a.lineHeight, borderBottomWidth = _a.borderBottomWidth, borderTopWidth = _a.borderTopWidth, paddingBottom = _a.paddingBottom, paddingTop = _a.paddingTop;
72
- var maxHeight = rowRange.max * parseFloat(lineHeight) +
73
- parseFloat(borderTopWidth) +
74
- parseFloat(borderBottomWidth) +
75
- parseFloat(paddingTop) +
76
- parseFloat(paddingBottom);
77
- var scrollHeight = textArea.scrollHeight +
78
- parseFloat(borderTopWidth) +
79
- parseFloat(borderBottomWidth);
80
- return Math.min(scrollHeight, maxHeight);
81
- }
82
- function insertText(text) {
83
- var _a;
84
- var input = inputRef.current;
85
- if (input) {
86
- insertAtCursor(input, text);
87
- var newValue = input.value;
88
- (_a = actionsRef.current) === null || _a === void 0 ? void 0 : _a.setValue(newValue);
89
- props.onChange && props.onChange(newValue);
90
- }
91
- }
92
- }
93
- var InputText = React.forwardRef(InputTextInternal);
94
- function insertAtCursor(input, newText) {
95
- var start = input.selectionStart || 0;
96
- var end = input.selectionEnd || 0;
97
- var text = input.value;
98
- var before = text.substring(0, start);
99
- var after = text.substring(end, text.length);
100
- input.value = before + newText + after;
101
- input.selectionStart = input.selectionEnd = start + newText.length;
102
- input.focus();
103
- }
104
24
 
105
- exports.InputText = InputText;
25
+ exports.InputText = InputText.InputText;
@@ -0,0 +1,91 @@
1
+ 'use strict';
2
+
3
+ var tslib_es6 = require('./tslib.es6-5b50eb8e.js');
4
+ var React = require('react');
5
+ var FormField = require('./FormField-a92c7bac.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 InputTextInternal(props, ref) {
12
+ var inputRef = React.createRef();
13
+ var actionsRef = React.createRef();
14
+ var rowRange = getRowRange();
15
+ React.useImperativeHandle(ref, function () { return ({
16
+ insert: function (text) {
17
+ insertText(text);
18
+ },
19
+ blur: function () {
20
+ var input = inputRef.current;
21
+ if (input) {
22
+ input.blur();
23
+ }
24
+ },
25
+ focus: function () {
26
+ var input = inputRef.current;
27
+ if (input) {
28
+ input.focus();
29
+ }
30
+ },
31
+ }); });
32
+ return (React__default["default"].createElement(FormField.FormField, tslib_es6.__assign({}, props, { type: props.multiline ? "textarea" : "text", inputRef: inputRef, actionsRef: actionsRef, onChange: handleChange, rows: rowRange.min })));
33
+ function handleChange(newValue) {
34
+ props.onChange && props.onChange(newValue);
35
+ if (inputRef && inputRef.current instanceof HTMLTextAreaElement) {
36
+ resize(inputRef.current);
37
+ }
38
+ }
39
+ function getRowRange() {
40
+ if (props.rows === undefined) {
41
+ return { min: 3, max: 3 };
42
+ }
43
+ else if (typeof props.rows === "object") {
44
+ return { min: props.rows.min, max: props.rows.max };
45
+ }
46
+ else {
47
+ return { min: props.rows, max: props.rows };
48
+ }
49
+ }
50
+ function resize(textArea) {
51
+ if (rowRange.min === rowRange.max)
52
+ return;
53
+ textArea.style.height = "auto";
54
+ textArea.style.height = textAreaHeight(textArea) + "px";
55
+ }
56
+ function textAreaHeight(textArea) {
57
+ var _a = window.getComputedStyle(textArea), lineHeight = _a.lineHeight, borderBottomWidth = _a.borderBottomWidth, borderTopWidth = _a.borderTopWidth, paddingBottom = _a.paddingBottom, paddingTop = _a.paddingTop;
58
+ var maxHeight = rowRange.max * parseFloat(lineHeight) +
59
+ parseFloat(borderTopWidth) +
60
+ parseFloat(borderBottomWidth) +
61
+ parseFloat(paddingTop) +
62
+ parseFloat(paddingBottom);
63
+ var scrollHeight = textArea.scrollHeight +
64
+ parseFloat(borderTopWidth) +
65
+ parseFloat(borderBottomWidth);
66
+ return Math.min(scrollHeight, maxHeight);
67
+ }
68
+ function insertText(text) {
69
+ var _a;
70
+ var input = inputRef.current;
71
+ if (input) {
72
+ insertAtCursor(input, text);
73
+ var newValue = input.value;
74
+ (_a = actionsRef.current) === null || _a === void 0 ? void 0 : _a.setValue(newValue);
75
+ props.onChange && props.onChange(newValue);
76
+ }
77
+ }
78
+ }
79
+ var InputText = React.forwardRef(InputTextInternal);
80
+ function insertAtCursor(input, newText) {
81
+ var start = input.selectionStart || 0;
82
+ var end = input.selectionEnd || 0;
83
+ var text = input.value;
84
+ var before = text.substring(0, start);
85
+ var after = text.substring(end, text.length);
86
+ input.value = before + newText + after;
87
+ input.selectionStart = input.selectionEnd = start + newText.length;
88
+ input.focus();
89
+ }
90
+
91
+ exports.InputText = InputText;
@@ -1,2 +1,2 @@
1
- import { InputTimeProps } from "./InputTimeProps";
2
- export declare function InputTime({ defaultValue, value, onChange, ...params }: InputTimeProps): JSX.Element;
1
+ import { InputTimeProps } from "./InputTimeProps";
2
+ export declare function InputTime({ defaultValue, value, onChange, ...params }: InputTimeProps): JSX.Element;
@@ -1,18 +1,18 @@
1
- import { CivilTime } from "@std-proposal/temporal";
2
- import { CommonFormFieldProps, FormFieldProps } from "../FormField";
3
- export interface InputTimeProps extends Pick<CommonFormFieldProps, "align" | "disabled" | "invalid" | "inline" | "loading" | "name" | "onValidation" | "placeholder" | "size">, Pick<FormFieldProps, "maxLength" | "readonly" | "autocomplete" | "max" | "min" | "onEnter" | "onFocus" | "onBlur" | "inputRef" | "validations"> {
4
- /**
5
- * Intial value of the input. Only use this when you need to prepopulate the
6
- * field with a data that is not controlled by the components state. If a
7
- * state is controlling the value, use the `value` prop instead.
8
- */
9
- readonly defaultValue?: CivilTime;
10
- /**
11
- * Set the component to the given value.
12
- */
13
- readonly value?: CivilTime;
14
- /**
15
- * Function called when user changes input value.
16
- */
17
- onChange?(newValue?: CivilTime): void;
18
- }
1
+ import { CivilTime } from "@std-proposal/temporal";
2
+ import { CommonFormFieldProps, FormFieldProps } from "../FormField";
3
+ export interface InputTimeProps extends Pick<CommonFormFieldProps, "align" | "disabled" | "invalid" | "inline" | "loading" | "name" | "onValidation" | "placeholder" | "size">, Pick<FormFieldProps, "maxLength" | "readonly" | "autocomplete" | "max" | "min" | "onEnter" | "onFocus" | "onBlur" | "inputRef" | "validations"> {
4
+ /**
5
+ * Intial value of the input. Only use this when you need to prepopulate the
6
+ * field with a data that is not controlled by the components state. If a
7
+ * state is controlling the value, use the `value` prop instead.
8
+ */
9
+ readonly defaultValue?: CivilTime;
10
+ /**
11
+ * Set the component to the given value.
12
+ */
13
+ readonly value?: CivilTime;
14
+ /**
15
+ * Function called when user changes input value.
16
+ */
17
+ onChange?(newValue?: CivilTime): void;
18
+ }
@@ -1,2 +1,2 @@
1
- import { InputTimeProps } from "./InputTimeProps";
2
- export declare function InputTimeSafari({ defaultValue, value, onChange, ...params }: InputTimeProps): JSX.Element;
1
+ import { InputTimeProps } from "./InputTimeProps";
2
+ export declare function InputTimeSafari({ defaultValue, value, onChange, ...params }: InputTimeProps): JSX.Element;
@@ -1,3 +1,3 @@
1
- import { CivilTime } from "@std-proposal/temporal";
2
- export declare function civilTimeToHTMLTime(civilTime?: CivilTime): string;
3
- export declare function htmlTimeToCivilTime(timeString: string): CivilTime | undefined;
1
+ import { CivilTime } from "@std-proposal/temporal";
2
+ export declare function civilTimeToHTMLTime(civilTime?: CivilTime): string;
3
+ export declare function htmlTimeToCivilTime(timeString: string): CivilTime | undefined;
@@ -1 +1 @@
1
- export { InputTime } from "./InputTime";
1
+ export { InputTime } from "./InputTime";