@wavv/ui 2.2.2-alpha.4 → 2.2.2-alpha.6

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 (230) hide show
  1. package/build/assets/icons/CaretDown.js +18 -0
  2. package/build/assets/icons/CaretUp.js +18 -0
  3. package/build/assets/icons/Checkbox.js +15 -0
  4. package/build/assets/icons/CheckboxOff.js +15 -0
  5. package/build/assets/icons/CheckboxPartial.js +15 -0
  6. package/build/assets/icons/Dialpad.js +18 -0
  7. package/build/assets/icons/Exclamation.js +25 -0
  8. package/build/assets/icons/Phone.js +13 -0
  9. package/build/assets/icons/PhoneAdd.js +21 -0
  10. package/build/assets/icons/PhoneBlocked.js +22 -0
  11. package/build/assets/icons/PhoneCallback.js +21 -0
  12. package/build/assets/icons/PhoneEnd.js +28 -0
  13. package/build/assets/icons/PhoneForward.js +22 -0
  14. package/build/assets/icons/PhoneHistory.js +21 -0
  15. package/build/assets/icons/PhoneHold.js +22 -0
  16. package/build/assets/icons/PhoneIncoming.js +22 -0
  17. package/build/assets/icons/PhoneMissed.js +22 -0
  18. package/build/assets/icons/PhoneTalk.js +22 -0
  19. package/build/assets/icons/PhoneTransfer.js +21 -0
  20. package/build/assets/icons/RadioButton.js +22 -0
  21. package/build/assets/icons/RadioButtonOff.js +15 -0
  22. package/build/assets/icons/Record.js +18 -0
  23. package/build/assets/icons/Screenshot.js +39 -0
  24. package/build/assets/icons/ShieldWavv.js +30 -0
  25. package/build/assets/icons/Spotify.js +15 -0
  26. package/build/assets/icons/SubArrow.js +16 -0
  27. package/build/assets/icons/ToggleOff.js +15 -0
  28. package/build/assets/icons/ToggleOn.js +15 -0
  29. package/build/assets/icons/TransferCancel.js +60 -0
  30. package/build/components/Accordion/Accordion.js +26 -0
  31. package/build/components/Accordion/Header.js +86 -0
  32. package/build/components/Accordion/Item.js +25 -0
  33. package/build/components/Accordion/Panel.js +64 -0
  34. package/build/components/Accordion/index.js +2 -0
  35. package/build/components/Audio.js +248 -0
  36. package/build/components/BarChart.js +123 -0
  37. package/build/components/Button/Button.js +258 -0
  38. package/build/components/Button/ButtonLoader.js +20 -0
  39. package/build/components/Button/ButtonTypes.js +0 -0
  40. package/build/components/Button/Group.js +58 -0
  41. package/build/components/Button/index.js +2 -0
  42. package/build/components/Calendar.js +49 -0
  43. package/build/components/CalendarParts/CalendarContainerStyles.js +15 -0
  44. package/build/components/CalendarParts/CalendarContent.js +138 -0
  45. package/build/components/CalendarParts/CalendarHeader.js +146 -0
  46. package/build/components/CalendarParts/useMinMax.js +23 -0
  47. package/build/components/CalendarParts/utils.js +6 -0
  48. package/build/components/ChartHelpers.js +121 -0
  49. package/build/components/Checkbox.js +85 -0
  50. package/build/components/Code/Code.js +117 -0
  51. package/build/components/Code/Copy.js +50 -0
  52. package/build/components/Code/Endpoint.js +82 -0
  53. package/build/components/Code/index.js +3 -0
  54. package/build/components/ComboBox.js +190 -0
  55. package/build/components/CommandMenu/CommandItem.js +32 -0
  56. package/build/components/CommandMenu/CommandMenu.js +136 -0
  57. package/build/components/CommandMenu/CommandOptions.js +24 -0
  58. package/build/components/CommandMenu/CommandSection.js +19 -0
  59. package/build/components/CommandMenu/index.js +2 -0
  60. package/build/components/DateRangeSelect.js +359 -0
  61. package/build/components/DocTable.js +32 -0
  62. package/build/components/Dot.js +60 -0
  63. package/build/components/DraftEditor.js +188 -0
  64. package/build/components/Dropdown.js +130 -0
  65. package/build/components/DropdownMenu.js +131 -0
  66. package/build/components/DropdownMenuParts/Menu.js +6 -0
  67. package/build/components/DropdownMenuParts/MenuItem.js +54 -0
  68. package/build/components/DropdownMenuParts/MenuOptions.js +47 -0
  69. package/build/components/DropdownMenuParts/MenuSection.js +14 -0
  70. package/build/components/DropdownSelect.js +171 -0
  71. package/build/components/DynamicIcon.js +49 -0
  72. package/build/components/Editor/Editor.js +356 -0
  73. package/build/components/Editor/EditorStyles.js +259 -0
  74. package/build/components/Editor/MergeFieldExtension.js +110 -0
  75. package/build/components/Editor/RichTextToolbar.js +515 -0
  76. package/build/components/Editor/editorUtils.js +213 -0
  77. package/build/components/Editor/index.js +3 -0
  78. package/build/components/Ellipsis.js +22 -0
  79. package/build/components/Focusable.js +20 -0
  80. package/build/components/Form.js +68 -0
  81. package/build/components/FormControl.js +72 -0
  82. package/build/components/Grid.js +53 -0
  83. package/build/components/Icon/Icon.js +89 -0
  84. package/build/components/Icon/customIcons.js +48 -0
  85. package/build/components/Icon/icons.js +145 -0
  86. package/build/components/Icon/index.js +3 -0
  87. package/build/components/ImageViewer.js +142 -0
  88. package/build/components/InlineCode.js +10 -0
  89. package/build/components/InputHelpers.js +106 -0
  90. package/build/components/Inputs/DatePicker.js +111 -0
  91. package/build/components/Inputs/DateRangePicker.js +166 -0
  92. package/build/components/Inputs/InlineInput.js +71 -0
  93. package/build/components/Inputs/NumberInput.js +117 -0
  94. package/build/components/Inputs/PhoneInput.js +96 -0
  95. package/build/components/Inputs/SearchInput.js +84 -0
  96. package/build/components/Inputs/TextArea.js +164 -0
  97. package/build/components/Inputs/TextInput.js +74 -0
  98. package/build/components/Inputs/TimeInput.js +74 -0
  99. package/build/components/Inputs/helpers/AriaButton.js +19 -0
  100. package/build/components/Inputs/helpers/DateSegment.js +22 -0
  101. package/build/components/Inputs/helpers/Description.js +11 -0
  102. package/build/components/Inputs/helpers/ErrorMessage.js +11 -0
  103. package/build/components/Inputs/helpers/Input.js +6 -0
  104. package/build/components/Inputs/helpers/InputContainerStyles.js +78 -0
  105. package/build/components/Inputs/helpers/InputMessage.js +30 -0
  106. package/build/components/Inputs/helpers/InputStyles.js +43 -0
  107. package/build/components/Inputs/helpers/Label.js +42 -0
  108. package/build/components/Inputs/helpers/LabelWrapper.js +14 -0
  109. package/build/components/Inputs/helpers/PickerToggle.js +7 -0
  110. package/build/components/Inputs/helpers/TextArea.js +8 -0
  111. package/build/components/Inputs/helpers/filterPastedText.js +9 -0
  112. package/build/components/Inputs/helpers/handlePaste.js +12 -0
  113. package/build/components/Inputs/helpers/isAcceptable.js +7 -0
  114. package/build/components/Inputs/helpers/useDynamicWidth.js +39 -0
  115. package/build/components/Inputs/helpers/useInputFocus.js +19 -0
  116. package/build/components/Label.js +42 -0
  117. package/build/components/LineChart.js +80 -0
  118. package/build/components/ListBoxParts/GridListItem.js +34 -0
  119. package/build/components/ListBoxParts/ListBoxItem.js +32 -0
  120. package/build/components/ListBoxParts/ListOptions.js +45 -0
  121. package/build/components/ListHelpers/GridListHeader.js +14 -0
  122. package/build/components/ListHelpers/GridListSection.js +14 -0
  123. package/build/components/ListHelpers/ItemHeaderBody.js +36 -0
  124. package/build/components/ListHelpers/ListHeader.js +14 -0
  125. package/build/components/ListHelpers/ListItemStyles.js +52 -0
  126. package/build/components/ListHelpers/ListRootStyles.js +14 -0
  127. package/build/components/ListHelpers/ListSection.js +14 -0
  128. package/build/components/ListHelpers/ListStyles.js +29 -0
  129. package/build/components/Menu.js +159 -0
  130. package/build/components/Message.js +107 -0
  131. package/build/components/MessageHr.js +32 -0
  132. package/build/components/Modal.js +212 -0
  133. package/build/components/MotionPopover.js +39 -0
  134. package/build/components/MultiSelect/MultiSelect.js +263 -0
  135. package/build/components/MultiSelect/SearchDropdown.js +155 -0
  136. package/build/components/MultiSelect/index.js +2 -0
  137. package/build/components/OptionHelpers/Container.js +34 -0
  138. package/build/components/OptionHelpers/Item.js +59 -0
  139. package/build/components/OptionHelpers/types.js +0 -0
  140. package/build/components/Pagination.js +121 -0
  141. package/build/components/PieChart.js +40 -0
  142. package/build/components/Popover.js +40 -0
  143. package/build/components/PortalScope.js +8 -0
  144. package/build/components/Progress/CirclePercent.js +56 -0
  145. package/build/components/Progress/Progress.js +59 -0
  146. package/build/components/Progress/index.js +3 -0
  147. package/build/components/Radio.js +45 -0
  148. package/build/components/RangeCalendar.js +60 -0
  149. package/build/components/Select.js +162 -0
  150. package/build/components/Slider.js +50 -0
  151. package/build/components/Spinner.js +70 -0
  152. package/build/components/Table/Body.js +49 -0
  153. package/build/components/Table/Cell.js +63 -0
  154. package/build/components/Table/Check.js +35 -0
  155. package/build/components/Table/Column.js +129 -0
  156. package/build/components/Table/ColumnSort.js +26 -0
  157. package/build/components/Table/Header.js +64 -0
  158. package/build/components/Table/Resizer.js +25 -0
  159. package/build/components/Table/Row.js +84 -0
  160. package/build/components/Table/SortCaret.js +24 -0
  161. package/build/components/Table/Table.js +88 -0
  162. package/build/components/Table/contentStyles.js +20 -0
  163. package/build/components/Table/context.js +4 -0
  164. package/build/components/Table/index.js +2 -0
  165. package/build/components/Table/types.js +0 -0
  166. package/build/components/Tabs.js +151 -0
  167. package/build/components/Tag.js +71 -0
  168. package/build/components/Toggle.js +59 -0
  169. package/build/components/ToggleButton/ToggleButton.js +104 -0
  170. package/build/components/ToggleButton/ToggleButtonGroup.js +36 -0
  171. package/build/components/ToggleButton/context.js +8 -0
  172. package/build/components/ToggleButton/index.js +3 -0
  173. package/build/components/Tooltip.js +136 -0
  174. package/build/components/TransferList.js +234 -0
  175. package/build/components/Tree/Tree.js +69 -0
  176. package/build/components/Tree/TreeContext.js +3 -0
  177. package/build/components/Tree/TreeItem.js +93 -0
  178. package/build/components/Tree/index.js +2 -0
  179. package/build/components/UnstyledButton.js +8 -0
  180. package/build/components/Waveform.js +243 -0
  181. package/build/components/draftUtils.js +193 -0
  182. package/build/components/helpers/getIcon.js +28 -0
  183. package/build/components/helpers/getPopPosition.js +20 -0
  184. package/build/components/helpers/isPropAllowed.js +3 -0
  185. package/build/components/helpers/mergePadding.js +47 -0
  186. package/build/components/helpers/styledProps.js +34 -0
  187. package/build/components/typeDefs/elementTypes.js +0 -0
  188. package/build/components/typeDefs/inputTypes.js +0 -0
  189. package/build/components/typeDefs/selectionTypes.js +0 -0
  190. package/build/components/typeDefs/tagTypes.js +0 -0
  191. package/build/components/types.js +0 -0
  192. package/build/global-styles/GlobalStorybookStyles.js +108 -0
  193. package/build/global-styles/ResetStyles.js +33 -0
  194. package/build/global-styles/ScrollbarStyles.js +26 -0
  195. package/build/global-styles/ToastStyles.js +66 -0
  196. package/build/global-styles/index.js +4 -0
  197. package/build/hooks/index.js +9 -0
  198. package/build/hooks/useConfirm.js +91 -0
  199. package/build/hooks/useControlledOpenState.js +22 -0
  200. package/build/hooks/useCopy.js +28 -0
  201. package/build/hooks/useElementObserver.js +6 -0
  202. package/build/hooks/useEventListener.js +19 -0
  203. package/build/hooks/useOnClickOutside.js +21 -0
  204. package/build/hooks/usePrevious.js +12 -0
  205. package/build/hooks/useSelectAll.js +60 -0
  206. package/build/hooks/useWindowSize.js +25 -0
  207. package/build/index.js +79 -12348
  208. package/build/theme/ThemeTypes.js +0 -0
  209. package/build/theme/common/button.js +33 -0
  210. package/build/theme/common/common.js +38 -0
  211. package/build/theme/common/index.js +4 -0
  212. package/build/theme/core/colors.js +77 -0
  213. package/build/theme/core/dark/dark.js +457 -0
  214. package/build/theme/core/dark/darkScale.js +36 -0
  215. package/build/theme/core/light/light.js +456 -0
  216. package/build/theme/core/light/lightScale.js +35 -0
  217. package/build/theme/eighties/colors.js +78 -0
  218. package/build/theme/eighties/dark/dark.js +457 -0
  219. package/build/theme/eighties/dark/darkScale.js +36 -0
  220. package/build/theme/eighties/light/light.js +456 -0
  221. package/build/theme/eighties/light/lightScale.js +35 -0
  222. package/build/theme/index.js +28 -0
  223. package/build/utils/chunk.js +13 -0
  224. package/build/utils/copyToClipboard.js +29 -0
  225. package/build/utils/flattenListOptions.js +4 -0
  226. package/build/utils/formatDate.js +55 -0
  227. package/build/utils/index.js +6 -0
  228. package/build/utils/numberWithCommas.js +3 -0
  229. package/build/utils/range.js +11 -0
  230. package/package.json +6 -2
@@ -0,0 +1,71 @@
1
+ import { jsx, jsxs } from "react/jsx-runtime";
2
+ import styled from "@emotion/styled";
3
+ import { useEffect, useState } from "react";
4
+ import { TextField } from "react-aria-components";
5
+ import getIcon from "../helpers/getIcon.js";
6
+ import Spinner from "../Spinner.js";
7
+ import handlePaste from "./helpers/handlePaste.js";
8
+ import Input from "./helpers/Input.js";
9
+ import InputContainerStyles from "./helpers/InputContainerStyles.js";
10
+ import InputMessage from "./helpers/InputMessage.js";
11
+ import isAcceptable from "./helpers/isAcceptable.js";
12
+ import useDynamicWidth from "./helpers/useDynamicWidth.js";
13
+ const InlineInput_InlineInput = ({ value, label, placeholder, iconLeft, iconRight, loading, fontSize, placeholderColor, disabled, readOnly, invalid, required, description, errorMessage, accepts, onChange, onInput, ref, ...props })=>{
14
+ const [inputValue, setInputValue] = useState('');
15
+ const [inputWidth, HiddenWidthEl] = useDynamicWidth({
16
+ value: inputValue,
17
+ placeholder,
18
+ fontSize
19
+ });
20
+ useEffect(()=>{
21
+ if (null != value && inputValue !== value) setInputValue(value);
22
+ }, [
23
+ value
24
+ ]);
25
+ const handleChange = (val)=>{
26
+ if (!isAcceptable(val, accepts)) return;
27
+ setInputValue(val);
28
+ if (onChange) onChange(val);
29
+ };
30
+ const handleInput = (event)=>{
31
+ const { value: val } = event.target;
32
+ if (onInput && isAcceptable(val, accepts)) onInput(event);
33
+ };
34
+ return /*#__PURE__*/ jsxs(InputContainer, {
35
+ value: inputValue,
36
+ hasLabel: !!label,
37
+ isDisabled: disabled,
38
+ isReadOnly: readOnly || loading,
39
+ isInvalid: invalid,
40
+ isRequired: required,
41
+ onChange: handleChange,
42
+ onInput: onInput ? handleInput : void 0,
43
+ onPaste: (event)=>handlePaste(event, handleChange, accepts),
44
+ textOnly: true,
45
+ ...props,
46
+ children: [
47
+ iconLeft && getIcon(iconLeft, {
48
+ marginRight: 8
49
+ }),
50
+ /*#__PURE__*/ jsx(Input, {
51
+ ref: ref,
52
+ placeholder: placeholder,
53
+ hide: !!(!inputValue && label),
54
+ fontSize: fontSize,
55
+ placeholderColor: placeholderColor,
56
+ isDisabled: disabled,
57
+ width: inputWidth
58
+ }),
59
+ /*#__PURE__*/ jsx(HiddenWidthEl, {}),
60
+ iconRight && getIcon(iconRight),
61
+ loading && /*#__PURE__*/ jsx(Spinner, {}),
62
+ /*#__PURE__*/ jsx(InputMessage, {
63
+ description: description,
64
+ errorMessage: errorMessage
65
+ })
66
+ ]
67
+ });
68
+ };
69
+ const InputContainer = styled(TextField)(InputContainerStyles);
70
+ const InlineInput = InlineInput_InlineInput;
71
+ export { InlineInput as default };
@@ -0,0 +1,117 @@
1
+ import { jsx, jsxs } from "react/jsx-runtime";
2
+ import styled from "@emotion/styled";
3
+ import { useEffect, useState } from "react";
4
+ import { NumberField } from "react-aria-components";
5
+ import getIcon from "../helpers/getIcon.js";
6
+ import Icon from "../Icon/index.js";
7
+ import Spinner from "../Spinner.js";
8
+ import AriaButton from "./helpers/AriaButton.js";
9
+ import Input from "./helpers/Input.js";
10
+ import InputContainerStyles from "./helpers/InputContainerStyles.js";
11
+ import InputMessage from "./helpers/InputMessage.js";
12
+ import Label from "./helpers/Label.js";
13
+ const NumberInput = ({ value, label, placeholder, iconLeft, iconRight, loading, fontSize, placeholderColor, disabled, readOnly, invalid, required, description, errorMessage, hideControls, separator = true, onChange, ref, ...props })=>{
14
+ const [inputValue, setInputValue] = useState(NaN);
15
+ useEffect(()=>{
16
+ if (null != value && inputValue !== value) setInputValue(value);
17
+ }, [
18
+ value
19
+ ]);
20
+ const handleChange = (val)=>{
21
+ setInputValue(val);
22
+ if (onChange) onChange(val);
23
+ };
24
+ const hasValue = !Number.isNaN(inputValue) && null != inputValue;
25
+ return /*#__PURE__*/ jsxs(InputContainer, {
26
+ value: inputValue,
27
+ onChange: handleChange,
28
+ hasLabel: !!label,
29
+ paddingRight: 0,
30
+ isDisabled: disabled,
31
+ isReadOnly: readOnly || loading,
32
+ isInvalid: invalid,
33
+ isRequired: required,
34
+ formatOptions: {
35
+ useGrouping: separator
36
+ },
37
+ ...props,
38
+ children: [
39
+ iconLeft && getIcon(iconLeft, {
40
+ marginRight: 8
41
+ }),
42
+ /*#__PURE__*/ jsx(Label, {
43
+ label: label,
44
+ filled: hasValue,
45
+ disabled: disabled,
46
+ children: /*#__PURE__*/ jsx(Input, {
47
+ ref: ref,
48
+ placeholder: placeholder,
49
+ hide: !!(!hasValue && label),
50
+ fontSize: fontSize,
51
+ placeholderColor: placeholderColor,
52
+ isDisabled: disabled
53
+ })
54
+ }),
55
+ iconRight && getIcon(iconRight),
56
+ loading && /*#__PURE__*/ jsx(Spinner, {}),
57
+ !hideControls && /*#__PURE__*/ jsxs(ArrowContainer, {
58
+ children: [
59
+ /*#__PURE__*/ jsx(ArrowButton, {
60
+ slot: "increment",
61
+ isDisabled: disabled || readOnly,
62
+ children: /*#__PURE__*/ jsx(Icon, {
63
+ size: label ? 23.5 : 19.5,
64
+ name: "caret-up"
65
+ })
66
+ }),
67
+ /*#__PURE__*/ jsx(Divider, {}),
68
+ /*#__PURE__*/ jsx(ArrowButton, {
69
+ slot: "decrement",
70
+ isDisabled: disabled || readOnly,
71
+ children: /*#__PURE__*/ jsx(Icon, {
72
+ size: label ? 23.5 : 19.5,
73
+ name: "caret-down"
74
+ })
75
+ })
76
+ ]
77
+ }),
78
+ /*#__PURE__*/ jsx(InputMessage, {
79
+ description: description,
80
+ errorMessage: errorMessage
81
+ })
82
+ ]
83
+ });
84
+ };
85
+ const InputContainer = styled(NumberField)(InputContainerStyles);
86
+ const ArrowContainer = styled.div(({ theme })=>({
87
+ display: 'flex',
88
+ flexDirection: 'column',
89
+ justifyContent: 'space-between',
90
+ borderLeft: theme.defaultBorder,
91
+ overflow: 'hidden',
92
+ borderTopRightRadius: 4,
93
+ borderBottomRightRadius: 4
94
+ }));
95
+ const ArrowButton = styled(AriaButton)(({ theme, isDisabled })=>({
96
+ height: '100%',
97
+ display: 'flex',
98
+ justifyContent: 'center',
99
+ alignItems: 'center',
100
+ overflow: 'hidden',
101
+ borderRadius: 0,
102
+ color: isDisabled ? theme.scale4 : void 0,
103
+ pointerEvents: isDisabled ? 'none' : void 0,
104
+ '&:hover': {
105
+ backgroundColor: isDisabled ? void 0 : theme.scale1
106
+ },
107
+ '&:active': {
108
+ backgroundColor: theme.scale0
109
+ }
110
+ }));
111
+ const Divider = styled.div(({ theme })=>({
112
+ height: 1,
113
+ width: '100%',
114
+ backgroundColor: theme.scale1
115
+ }));
116
+ const Inputs_NumberInput = NumberInput;
117
+ export { Inputs_NumberInput as default };
@@ -0,0 +1,96 @@
1
+ import { jsx, jsxs } from "react/jsx-runtime";
2
+ import styled from "@emotion/styled";
3
+ import libphonenumber_js from "libphonenumber-js";
4
+ import { useEffect, useImperativeHandle, useRef, useState } from "react";
5
+ import { TextField } from "react-aria-components";
6
+ import { format, normalize } from "react-phone-input-auto-format";
7
+ import getIcon from "../helpers/getIcon.js";
8
+ import Spinner from "../Spinner.js";
9
+ import Input from "./helpers/Input.js";
10
+ import InputContainerStyles from "./helpers/InputContainerStyles.js";
11
+ import InputMessage from "./helpers/InputMessage.js";
12
+ import Label from "./helpers/Label.js";
13
+ const PhoneInput_PhoneInput = ({ value, label, placeholder, iconLeft, iconRight, leftElement, rightElement, loading, fontSize, placeholderColor, disabled, readOnly, invalid, required, description, errorMessage, onChange, ref, ...props })=>{
14
+ const [inputValue, setInputValue] = useState('');
15
+ const internalRef = useRef(null);
16
+ useImperativeHandle(ref, ()=>internalRef.current);
17
+ useEffect(()=>{
18
+ if (null != value && inputValue !== value) {
19
+ const raw = normalize(value);
20
+ const formatted = format(raw);
21
+ setInputValue(formatted);
22
+ const { current: input } = internalRef;
23
+ if (input && value === normalize(value)) {
24
+ const event = new Event('change', {
25
+ bubbles: true
26
+ });
27
+ const { prototype } = window.HTMLInputElement;
28
+ Object.getOwnPropertyDescriptor(prototype, 'value')?.set?.call(input, formatted);
29
+ input.dispatchEvent(event);
30
+ }
31
+ }
32
+ }, [
33
+ value
34
+ ]);
35
+ const handleChange = (val)=>{
36
+ const normalized = normalize(val);
37
+ if (normalized.length > 10 || val && !normalized) return;
38
+ const formatted = format(normalized);
39
+ if (inputValue === formatted) return;
40
+ setInputValue(formatted);
41
+ if (onChange) onChange(formatted, normalized);
42
+ };
43
+ const handlePaste = (event)=>{
44
+ event.stopPropagation();
45
+ event.preventDefault();
46
+ const { clipboardData } = event;
47
+ const text = clipboardData.getData('text');
48
+ let normalized = normalize(text);
49
+ if (text.includes('+')) {
50
+ const parsed = libphonenumber_js(text);
51
+ normalized = parsed?.nationalNumber || '';
52
+ }
53
+ if (normalized) handleChange(normalized);
54
+ };
55
+ return /*#__PURE__*/ jsxs(InputContainer, {
56
+ value: inputValue,
57
+ hasLabel: !!label,
58
+ isDisabled: disabled,
59
+ isReadOnly: readOnly || loading,
60
+ isInvalid: invalid,
61
+ isRequired: required,
62
+ onChange: handleChange,
63
+ onPaste: handlePaste,
64
+ type: "tel",
65
+ ...props,
66
+ children: [
67
+ iconLeft && getIcon(iconLeft, {
68
+ marginRight: 8
69
+ }),
70
+ leftElement,
71
+ /*#__PURE__*/ jsx(Label, {
72
+ label: label,
73
+ filled: !!inputValue,
74
+ disabled: disabled,
75
+ children: /*#__PURE__*/ jsx(Input, {
76
+ ref: internalRef,
77
+ placeholder: placeholder,
78
+ hide: !!(!inputValue && label),
79
+ fontSize: fontSize,
80
+ placeholderColor: placeholderColor,
81
+ isDisabled: disabled
82
+ })
83
+ }),
84
+ rightElement,
85
+ iconRight && getIcon(iconRight),
86
+ loading && /*#__PURE__*/ jsx(Spinner, {}),
87
+ /*#__PURE__*/ jsx(InputMessage, {
88
+ description: description,
89
+ errorMessage: errorMessage
90
+ })
91
+ ]
92
+ });
93
+ };
94
+ const InputContainer = styled(TextField)(InputContainerStyles);
95
+ const PhoneInput = PhoneInput_PhoneInput;
96
+ export { PhoneInput as default };
@@ -0,0 +1,84 @@
1
+ import { jsx, jsxs } from "react/jsx-runtime";
2
+ import { useTheme } from "@emotion/react";
3
+ import styled from "@emotion/styled";
4
+ import { useEffect, useState } from "react";
5
+ import { SearchField } from "react-aria-components";
6
+ import getIcon from "../helpers/getIcon.js";
7
+ import Icon from "../Icon/index.js";
8
+ import Spinner from "../Spinner.js";
9
+ import AriaButton from "./helpers/AriaButton.js";
10
+ import handlePaste from "./helpers/handlePaste.js";
11
+ import Input from "./helpers/Input.js";
12
+ import InputContainerStyles from "./helpers/InputContainerStyles.js";
13
+ import InputMessage from "./helpers/InputMessage.js";
14
+ import isAcceptable from "./helpers/isAcceptable.js";
15
+ import Label from "./helpers/Label.js";
16
+ const SearchInput = ({ value, label, placeholder, iconLeft, iconRight, leftElement, rightElement, loading, fontSize, placeholderColor, disabled, readOnly, invalid, required, description, errorMessage, accepts, onChange, onInput, ref, ...props })=>{
17
+ const { color } = useTheme();
18
+ const [inputValue, setInputValue] = useState('');
19
+ useEffect(()=>{
20
+ if (null != value && inputValue !== value) setInputValue(value);
21
+ }, [
22
+ value
23
+ ]);
24
+ const handleChange = (val)=>{
25
+ if (!isAcceptable(val, accepts)) return;
26
+ setInputValue(val);
27
+ if (onChange) onChange(val);
28
+ };
29
+ const handleInput = (event)=>{
30
+ const { value: val } = event.target;
31
+ if (onInput && isAcceptable(val, accepts)) onInput(event);
32
+ };
33
+ return /*#__PURE__*/ jsxs(InputContainer, {
34
+ value: inputValue,
35
+ hasLabel: !!label,
36
+ isDisabled: disabled,
37
+ isReadOnly: readOnly || loading,
38
+ isInvalid: invalid,
39
+ isRequired: required,
40
+ onChange: handleChange,
41
+ onInput: onInput ? handleInput : void 0,
42
+ onPaste: (event)=>handlePaste(event, handleChange, accepts),
43
+ ...props,
44
+ children: [
45
+ iconLeft && getIcon(iconLeft, {
46
+ marginRight: 8
47
+ }),
48
+ leftElement,
49
+ /*#__PURE__*/ jsx(Icon, {
50
+ name: "search",
51
+ marginRight: 8
52
+ }),
53
+ /*#__PURE__*/ jsx(Label, {
54
+ label: label,
55
+ filled: !!inputValue,
56
+ disabled: disabled,
57
+ children: /*#__PURE__*/ jsx(Input, {
58
+ ref: ref,
59
+ placeholder: placeholder,
60
+ hide: !!(!inputValue && label),
61
+ fontSize: fontSize,
62
+ placeholderColor: placeholderColor,
63
+ isDisabled: disabled
64
+ })
65
+ }),
66
+ rightElement,
67
+ iconRight && getIcon(iconRight),
68
+ loading && /*#__PURE__*/ jsx(Spinner, {}),
69
+ !!inputValue && !loading && /*#__PURE__*/ jsx(AriaButton, {
70
+ children: /*#__PURE__*/ jsx(Icon, {
71
+ name: "close-circle",
72
+ color: color.brand
73
+ })
74
+ }),
75
+ /*#__PURE__*/ jsx(InputMessage, {
76
+ description: description,
77
+ errorMessage: errorMessage
78
+ })
79
+ ]
80
+ });
81
+ };
82
+ const InputContainer = styled(SearchField)(InputContainerStyles);
83
+ const Inputs_SearchInput = SearchInput;
84
+ export { Inputs_SearchInput as default };
@@ -0,0 +1,164 @@
1
+ import { jsx, jsxs } from "react/jsx-runtime";
2
+ import styled from "@emotion/styled";
3
+ import { useEffect, useRef, useState } from "react";
4
+ import { TextField } from "react-aria-components";
5
+ import getIcon from "../helpers/getIcon.js";
6
+ import Spinner from "../Spinner.js";
7
+ import handlePaste from "./helpers/handlePaste.js";
8
+ import InputContainerStyles from "./helpers/InputContainerStyles.js";
9
+ import InputMessage from "./helpers/InputMessage.js";
10
+ import isAcceptable from "./helpers/isAcceptable.js";
11
+ import Label from "./helpers/Label.js";
12
+ import TextArea from "./helpers/TextArea.js";
13
+ const TextAreaComponent = ({ value, label, placeholder, iconLeft, iconRight, loading, fontSize, placeholderColor, disabled, readOnly, invalid, required, description, errorMessage, accepts, asTrigger, height, maxHeight, onChange, onInput, ref, ...props })=>{
14
+ const [inputValue, setInputValue] = useState('');
15
+ const textAreaRef = useRef(null);
16
+ useEffect(()=>{
17
+ if (null != value && inputValue !== value) setInputValue(value);
18
+ }, [
19
+ value
20
+ ]);
21
+ useEffect(()=>{
22
+ const textArea = textAreaRef.current;
23
+ if (!textArea || height && !maxHeight) return;
24
+ const autoResize = ()=>{
25
+ textArea.style.height = 'auto';
26
+ const scrollHeight = textArea.scrollHeight;
27
+ if (maxHeight) {
28
+ const maxHeightValue = 'string' == typeof maxHeight ? Number.parseInt(maxHeight, 10) : maxHeight;
29
+ const constrainedHeight = Math.min(scrollHeight, maxHeightValue - 10);
30
+ textArea.style.height = `${constrainedHeight}px`;
31
+ textArea.style.overflow = scrollHeight > maxHeightValue - 10 ? 'auto' : 'hidden';
32
+ } else if (!height) {
33
+ textArea.style.height = `${scrollHeight}px`;
34
+ textArea.style.overflow = 'hidden';
35
+ }
36
+ };
37
+ autoResize();
38
+ textArea.addEventListener('input', autoResize);
39
+ return ()=>{
40
+ textArea.removeEventListener('input', autoResize);
41
+ };
42
+ }, [
43
+ inputValue,
44
+ height,
45
+ maxHeight
46
+ ]);
47
+ const handleChange = (val)=>{
48
+ if (!isAcceptable(val, accepts)) return;
49
+ setInputValue(val);
50
+ if (onChange) onChange(val);
51
+ };
52
+ const handleInput = (event)=>{
53
+ const { value: val } = event.target;
54
+ if (onInput && isAcceptable(val, accepts)) onInput(event);
55
+ };
56
+ return /*#__PURE__*/ jsxs(TextAreaContainer, {
57
+ value: inputValue,
58
+ hasLabel: !!label,
59
+ isDisabled: disabled,
60
+ isReadOnly: readOnly || loading || asTrigger,
61
+ isInvalid: invalid,
62
+ isRequired: required,
63
+ onChange: handleChange,
64
+ onInput: onInput ? handleInput : void 0,
65
+ onPaste: (event)=>handlePaste(event, handleChange, accepts),
66
+ asTrigger: asTrigger,
67
+ height: height,
68
+ maxHeight: maxHeight,
69
+ ...props,
70
+ children: [
71
+ iconLeft && getIcon(iconLeft, {
72
+ marginRight: 8
73
+ }),
74
+ /*#__PURE__*/ jsx(Label, {
75
+ label: label,
76
+ filled: !!inputValue,
77
+ disabled: disabled,
78
+ children: /*#__PURE__*/ jsx(TextArea, {
79
+ ref: textAreaRef,
80
+ placeholder: placeholder,
81
+ hide: !!(!inputValue && label),
82
+ fontSize: fontSize,
83
+ placeholderColor: placeholderColor,
84
+ isDisabled: disabled,
85
+ tabIndex: asTrigger ? -1 : void 0
86
+ })
87
+ }),
88
+ iconRight && getIcon(iconRight),
89
+ loading && /*#__PURE__*/ jsx(Spinner, {}),
90
+ /*#__PURE__*/ jsx(InputMessage, {
91
+ description: description,
92
+ errorMessage: errorMessage
93
+ })
94
+ ]
95
+ });
96
+ };
97
+ const TextAreaContainer = styled(TextField)(InputContainerStyles, ({ asTrigger })=>({
98
+ pointerEvents: asTrigger ? 'none' : void 0
99
+ }), ({ height, maxHeight })=>{
100
+ const baseStyles = {
101
+ alignItems: 'stretch',
102
+ height: 'auto',
103
+ minHeight: 80,
104
+ '& > label': {
105
+ flex: 1,
106
+ display: 'flex',
107
+ flexDirection: 'column',
108
+ minHeight: 'inherit'
109
+ }
110
+ };
111
+ if (!height && !maxHeight) return {
112
+ ...baseStyles,
113
+ '& textarea': {
114
+ resize: 'none',
115
+ overflow: 'hidden'
116
+ }
117
+ };
118
+ if (height && !maxHeight) return {
119
+ ...baseStyles,
120
+ height,
121
+ minHeight: height,
122
+ maxHeight: height,
123
+ overflow: 'hidden',
124
+ '& > label': {
125
+ display: 'flex',
126
+ flexDirection: 'column',
127
+ height: '100%',
128
+ flex: 'none',
129
+ minHeight: 'auto'
130
+ },
131
+ '& textarea': {
132
+ flex: 1,
133
+ minHeight: 0,
134
+ overflow: 'auto'
135
+ }
136
+ };
137
+ if (!height && maxHeight) return {
138
+ ...baseStyles,
139
+ maxHeight,
140
+ '& textarea': {
141
+ overflow: 'auto',
142
+ minHeight: 20
143
+ }
144
+ };
145
+ if (height && maxHeight) return {
146
+ alignItems: 'stretch',
147
+ height: 'auto',
148
+ minHeight: height,
149
+ maxHeight,
150
+ '& > label': {
151
+ flex: 1,
152
+ display: 'flex',
153
+ flexDirection: 'column',
154
+ minHeight: 'inherit'
155
+ },
156
+ '& textarea': {
157
+ overflow: 'auto',
158
+ minHeight: 20
159
+ }
160
+ };
161
+ return baseStyles;
162
+ });
163
+ const Inputs_TextArea = TextAreaComponent;
164
+ export { Inputs_TextArea as default };
@@ -0,0 +1,74 @@
1
+ import { jsx, jsxs } from "react/jsx-runtime";
2
+ import styled from "@emotion/styled";
3
+ import { useEffect, useState } from "react";
4
+ import { TextField } from "react-aria-components";
5
+ import getIcon from "../helpers/getIcon.js";
6
+ import Spinner from "../Spinner.js";
7
+ import handlePaste from "./helpers/handlePaste.js";
8
+ import Input from "./helpers/Input.js";
9
+ import InputContainerStyles from "./helpers/InputContainerStyles.js";
10
+ import InputMessage from "./helpers/InputMessage.js";
11
+ import isAcceptable from "./helpers/isAcceptable.js";
12
+ import Label from "./helpers/Label.js";
13
+ const TextInput_TextInput = ({ value, label, placeholder, iconLeft, iconRight, leftElement, rightElement, loading, fontSize, placeholderColor, disabled, readOnly, invalid, required, description, errorMessage, accepts, asTrigger, onChange, onInput, ref, ...props })=>{
14
+ const [inputValue, setInputValue] = useState('');
15
+ useEffect(()=>{
16
+ if (null != value && inputValue !== value) setInputValue(value);
17
+ }, [
18
+ value
19
+ ]);
20
+ const handleChange = (val)=>{
21
+ if (!isAcceptable(val, accepts)) return;
22
+ setInputValue(val);
23
+ if (onChange) onChange(val);
24
+ };
25
+ const handleInput = (event)=>{
26
+ const { value: val } = event.target;
27
+ if (onInput && isAcceptable(val, accepts)) onInput(event);
28
+ };
29
+ return /*#__PURE__*/ jsxs(InputContainer, {
30
+ value: inputValue,
31
+ hasLabel: !!label,
32
+ isDisabled: disabled,
33
+ isReadOnly: readOnly || loading || asTrigger,
34
+ isInvalid: invalid,
35
+ isRequired: required,
36
+ onChange: handleChange,
37
+ onInput: onInput ? handleInput : void 0,
38
+ onPaste: (event)=>handlePaste(event, handleChange, accepts),
39
+ asTrigger: asTrigger,
40
+ ...props,
41
+ children: [
42
+ iconLeft && getIcon(iconLeft, {
43
+ marginRight: 8
44
+ }),
45
+ leftElement,
46
+ /*#__PURE__*/ jsx(Label, {
47
+ label: label,
48
+ filled: !!inputValue,
49
+ disabled: disabled,
50
+ children: /*#__PURE__*/ jsx(Input, {
51
+ ref: ref,
52
+ placeholder: placeholder,
53
+ hide: !!(!inputValue && label),
54
+ fontSize: fontSize,
55
+ placeholderColor: placeholderColor,
56
+ isDisabled: disabled,
57
+ tabIndex: asTrigger ? -1 : void 0
58
+ })
59
+ }),
60
+ rightElement,
61
+ iconRight && getIcon(iconRight),
62
+ loading && /*#__PURE__*/ jsx(Spinner, {}),
63
+ /*#__PURE__*/ jsx(InputMessage, {
64
+ description: description,
65
+ errorMessage: errorMessage
66
+ })
67
+ ]
68
+ });
69
+ };
70
+ const InputContainer = styled(TextField)(InputContainerStyles, ({ asTrigger })=>({
71
+ pointerEvents: asTrigger ? 'none' : void 0
72
+ }));
73
+ const TextInput = TextInput_TextInput;
74
+ export { TextInput as default };
@@ -0,0 +1,74 @@
1
+ import { jsx, jsxs } from "react/jsx-runtime";
2
+ import styled from "@emotion/styled";
3
+ import { Time, parseTime } from "@internationalized/date";
4
+ import { useEffect, useState } from "react";
5
+ import { DateInput, TimeField } from "react-aria-components";
6
+ import getIcon from "../helpers/getIcon.js";
7
+ import Spinner from "../Spinner.js";
8
+ import DateSegment from "./helpers/DateSegment.js";
9
+ import InputContainerStyles from "./helpers/InputContainerStyles.js";
10
+ import InputMessage from "./helpers/InputMessage.js";
11
+ import InputStyles, { preventProps } from "./helpers/InputStyles.js";
12
+ import Label from "./helpers/Label.js";
13
+ const TimeInput = ({ value, label, iconLeft, iconRight, loading, fontSize, placeholderColor, disabled, readOnly, invalid, required, description, errorMessage, onChange, ref, ...props })=>{
14
+ const [selectedTime, setSelectedTime] = useState(value ? parseTime(value) : null);
15
+ useEffect(()=>{
16
+ if (value) {
17
+ const selectedString = `${selectedTime?.hour}:${selectedTime?.minute}`;
18
+ if (selectedString !== value) setSelectedTime(parseTime(value));
19
+ }
20
+ }, [
21
+ value
22
+ ]);
23
+ const handleTimeChange = (val)=>{
24
+ if (!val) return;
25
+ const { hour, minute, second } = val;
26
+ const selected = new Time(hour, minute, second);
27
+ setSelectedTime(selected);
28
+ if (onChange) onChange(val.toString());
29
+ };
30
+ const inputHidden = !!(!selectedTime && label);
31
+ return /*#__PURE__*/ jsxs(InputContainer, {
32
+ value: selectedTime,
33
+ hasLabel: !!label,
34
+ isDisabled: disabled,
35
+ isReadOnly: readOnly || loading,
36
+ isInvalid: invalid,
37
+ isRequired: required,
38
+ onChange: handleTimeChange,
39
+ ...props,
40
+ children: [
41
+ iconLeft && getIcon(iconLeft, {
42
+ marginRight: 8
43
+ }),
44
+ /*#__PURE__*/ jsx(Label, {
45
+ label: label,
46
+ filled: !!selectedTime,
47
+ disabled: disabled,
48
+ children: /*#__PURE__*/ jsx(Input, {
49
+ ref: ref,
50
+ hide: inputHidden,
51
+ fontSize: fontSize,
52
+ placeholderColor: placeholderColor,
53
+ isDisabled: disabled,
54
+ children: (segment)=>/*#__PURE__*/ jsx(DateSegment, {
55
+ placeholderColor: placeholderColor,
56
+ segment: segment
57
+ })
58
+ })
59
+ }),
60
+ iconRight && getIcon(iconRight),
61
+ loading && /*#__PURE__*/ jsx(Spinner, {}),
62
+ /*#__PURE__*/ jsx(InputMessage, {
63
+ description: description,
64
+ errorMessage: errorMessage
65
+ })
66
+ ]
67
+ });
68
+ };
69
+ const InputContainer = styled(TimeField)(InputContainerStyles);
70
+ const Input = styled(DateInput, preventProps)({
71
+ display: 'flex'
72
+ }, InputStyles);
73
+ const Inputs_TimeInput = TimeInput;
74
+ export { Inputs_TimeInput as default };