@wavv/ui 2.2.2-alpha.5 → 2.2.2-alpha.7

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 (233) 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.d.ts +1 -0
  208. package/build/index.js +2 -1
  209. package/build/theme/ThemeTypes.js +0 -0
  210. package/build/theme/common/button.js +33 -0
  211. package/build/theme/common/common.js +38 -0
  212. package/build/theme/common/index.js +4 -0
  213. package/build/theme/core/colors.js +77 -0
  214. package/build/theme/core/dark/dark.js +457 -0
  215. package/build/theme/core/dark/darkScale.js +36 -0
  216. package/build/theme/core/light/light.js +456 -0
  217. package/build/theme/core/light/lightScale.js +35 -0
  218. package/build/theme/eighties/colors.js +78 -0
  219. package/build/theme/eighties/dark/dark.js +457 -0
  220. package/build/theme/eighties/dark/darkScale.js +36 -0
  221. package/build/theme/eighties/light/light.js +456 -0
  222. package/build/theme/eighties/light/lightScale.js +35 -0
  223. package/build/theme/index.js +28 -0
  224. package/build/utils/chunk.js +13 -0
  225. package/build/utils/copyToClipboard.js +29 -0
  226. package/build/utils/flattenListOptions.js +4 -0
  227. package/build/utils/formatDate.js +55 -0
  228. package/build/utils/formatNumber.d.ts +8 -0
  229. package/build/utils/formatNumber.js +32 -0
  230. package/build/utils/index.js +6 -0
  231. package/build/utils/numberWithCommas.js +3 -0
  232. package/build/utils/range.js +11 -0
  233. package/package.json +14 -15
@@ -0,0 +1,108 @@
1
+ import { jsx } from "react/jsx-runtime";
2
+ import { Global, useTheme } from "@emotion/react";
3
+ import { useEffect } from "react";
4
+ import "sanitize.css";
5
+ import webfontloader from "webfontloader";
6
+ const loadFonts = (fonts)=>{
7
+ webfontloader.load({
8
+ google: {
9
+ families: fonts || [
10
+ 'Roboto:100,300,400,500,700'
11
+ ]
12
+ }
13
+ });
14
+ };
15
+ const GlobalStorybookStyles = ({ families, fontFamily })=>{
16
+ const { scale1, scale10, font, toast, background0 } = useTheme();
17
+ useEffect(()=>{
18
+ loadFonts(families);
19
+ }, [
20
+ families
21
+ ]);
22
+ return /*#__PURE__*/ jsx(Global, {
23
+ styles: {
24
+ '.docs-story,.sb-show-main': {
25
+ backgroundColor: background0,
26
+ color: scale10
27
+ },
28
+ 'html,body': {
29
+ margin: 0,
30
+ fontFamily: fontFamily || "'Roboto', sans-serif",
31
+ WebkitFontSmoothing: 'antialiased',
32
+ MozOsxFontSmoothing: 'grayscale'
33
+ },
34
+ '::-webkit-scrollbar': {
35
+ width: 8,
36
+ height: 8
37
+ },
38
+ '::-webkit-scrollbar-track': {
39
+ backgroundColor: 'transparent',
40
+ border: 'none'
41
+ },
42
+ '::-webkit-scrollbar-thumb:horizontal, ::-webkit-scrollbar-thumb:vertical': {
43
+ backgroundColor: scale1,
44
+ WebkitBorderRadius: 6
45
+ },
46
+ '*': {
47
+ scrollbarColor: `${scale1} transparent`
48
+ },
49
+ '.Toastify__toast': {
50
+ color: toast.color,
51
+ borderRadius: 4,
52
+ fontFamily: font.family.default
53
+ },
54
+ '.Toastify__close-button': {
55
+ color: toast.color
56
+ },
57
+ '.Toastify__toast--default': {
58
+ background: toast.background.default,
59
+ border: `1px solid ${toast.border.default}`
60
+ },
61
+ '.Toastify__toast--info': {
62
+ background: toast.background.info,
63
+ border: `1px solid ${toast.border.info}`,
64
+ '& .Toastify__toast-icon > svg': {
65
+ fill: toast.border.info
66
+ }
67
+ },
68
+ '.Toastify__toast--success': {
69
+ background: toast.background.success,
70
+ border: `1px solid ${toast.border.success}`,
71
+ '& .Toastify__toast-icon > svg': {
72
+ fill: toast.border.success
73
+ }
74
+ },
75
+ '.Toastify__toast--warning': {
76
+ background: toast.background.warning,
77
+ border: `1px solid ${toast.border.warning}`,
78
+ '& .Toastify__toast-icon > svg': {
79
+ fill: toast.border.warning
80
+ }
81
+ },
82
+ '.Toastify__toast--error': {
83
+ background: toast.background.error,
84
+ border: `1px solid ${toast.border.error}`,
85
+ '& .Toastify__toast-icon > svg': {
86
+ fill: toast.border.error
87
+ }
88
+ },
89
+ '.Toastify__progress-bar--default': {
90
+ background: toast.border.default
91
+ },
92
+ '.Toastify__progress-bar--info': {
93
+ background: toast.border.info
94
+ },
95
+ '.Toastify__progress-bar--success': {
96
+ background: toast.border.success
97
+ },
98
+ '.Toastify__progress-bar--warning': {
99
+ background: toast.border.warning
100
+ },
101
+ '.Toastify__progress-bar--error': {
102
+ background: toast.border.error
103
+ }
104
+ }
105
+ });
106
+ };
107
+ const global_styles_GlobalStorybookStyles = GlobalStorybookStyles;
108
+ export { global_styles_GlobalStorybookStyles as default };
@@ -0,0 +1,33 @@
1
+ import { jsx } from "react/jsx-runtime";
2
+ import { useEffect } from "react";
3
+ import "sanitize.css";
4
+ import { Global } from "@emotion/react";
5
+ import webfontloader from "webfontloader";
6
+ const loadFonts = (fonts)=>{
7
+ webfontloader.load({
8
+ google: {
9
+ families: fonts || [
10
+ 'Roboto:100,300,400,500,700'
11
+ ]
12
+ }
13
+ });
14
+ };
15
+ const ResetStyles_ResetStyles = ({ families, fontFamily })=>{
16
+ useEffect(()=>{
17
+ loadFonts(families);
18
+ }, [
19
+ families
20
+ ]);
21
+ return /*#__PURE__*/ jsx(Global, {
22
+ styles: {
23
+ 'html,body': {
24
+ margin: 0,
25
+ fontFamily: fontFamily || "'Roboto', sans-serif",
26
+ WebkitFontSmoothing: 'antialiased',
27
+ MozOsxFontSmoothing: 'grayscale'
28
+ }
29
+ }
30
+ });
31
+ };
32
+ const ResetStyles = ResetStyles_ResetStyles;
33
+ export { ResetStyles as default };
@@ -0,0 +1,26 @@
1
+ import { jsx } from "react/jsx-runtime";
2
+ import { Global, useTheme } from "@emotion/react";
3
+ const ScrollbarStyles = ()=>{
4
+ const { scale1 } = useTheme();
5
+ return /*#__PURE__*/ jsx(Global, {
6
+ styles: {
7
+ '::-webkit-scrollbar': {
8
+ width: 8,
9
+ height: 8
10
+ },
11
+ '::-webkit-scrollbar-track': {
12
+ backgroundColor: 'transparent',
13
+ border: 'none'
14
+ },
15
+ '::-webkit-scrollbar-thumb:horizontal, ::-webkit-scrollbar-thumb:vertical': {
16
+ backgroundColor: scale1,
17
+ WebkitBorderRadius: 6
18
+ },
19
+ '*': {
20
+ scrollbarColor: `${scale1} transparent`
21
+ }
22
+ }
23
+ });
24
+ };
25
+ const global_styles_ScrollbarStyles = ScrollbarStyles;
26
+ export { global_styles_ScrollbarStyles as default };
@@ -0,0 +1,66 @@
1
+ import { jsx } from "react/jsx-runtime";
2
+ import { Global, useTheme } from "@emotion/react";
3
+ const ToastStyles = ()=>{
4
+ const { font, toast } = useTheme();
5
+ return /*#__PURE__*/ jsx(Global, {
6
+ styles: {
7
+ '.Toastify__toast': {
8
+ color: toast.color,
9
+ borderRadius: 4,
10
+ fontFamily: font.family.default
11
+ },
12
+ '.Toastify__close-button': {
13
+ color: toast.color
14
+ },
15
+ '.Toastify__toast--default': {
16
+ background: toast.background.default,
17
+ border: `1px solid ${toast.border.default}`
18
+ },
19
+ '.Toastify__toast--info': {
20
+ background: toast.background.info,
21
+ border: `1px solid ${toast.border.info}`,
22
+ '& .Toastify__toast-icon > svg': {
23
+ fill: toast.border.info
24
+ }
25
+ },
26
+ '.Toastify__toast--success': {
27
+ background: toast.background.success,
28
+ border: `1px solid ${toast.border.success}`,
29
+ '& .Toastify__toast-icon > svg': {
30
+ fill: toast.border.success
31
+ }
32
+ },
33
+ '.Toastify__toast--warning': {
34
+ background: toast.background.warning,
35
+ border: `1px solid ${toast.border.warning}`,
36
+ '& .Toastify__toast-icon > svg': {
37
+ fill: toast.border.warning
38
+ }
39
+ },
40
+ '.Toastify__toast--error': {
41
+ background: toast.background.error,
42
+ border: `1px solid ${toast.border.error}`,
43
+ '& .Toastify__toast-icon > svg': {
44
+ fill: toast.border.error
45
+ }
46
+ },
47
+ '.Toastify__progress-bar--default': {
48
+ background: toast.border.default
49
+ },
50
+ '.Toastify__progress-bar--info': {
51
+ background: toast.border.info
52
+ },
53
+ '.Toastify__progress-bar--success': {
54
+ background: toast.border.success
55
+ },
56
+ '.Toastify__progress-bar--warning': {
57
+ background: toast.border.warning
58
+ },
59
+ '.Toastify__progress-bar--error': {
60
+ background: toast.border.error
61
+ }
62
+ }
63
+ });
64
+ };
65
+ const global_styles_ToastStyles = ToastStyles;
66
+ export { global_styles_ToastStyles as default };
@@ -0,0 +1,4 @@
1
+ import ResetStyles from "./ResetStyles.js";
2
+ import ScrollbarStyles from "./ScrollbarStyles.js";
3
+ import ToastStyles from "./ToastStyles.js";
4
+ export { ResetStyles, ScrollbarStyles, ToastStyles };
@@ -0,0 +1,9 @@
1
+ import useControlledOpenState from "./useControlledOpenState.js";
2
+ import useCopy from "./useCopy.js";
3
+ import useElementObserver from "./useElementObserver.js";
4
+ import useEventListener from "./useEventListener.js";
5
+ import useOnClickOutside from "./useOnClickOutside.js";
6
+ import usePrevious from "./usePrevious.js";
7
+ import useSelectAll from "./useSelectAll.js";
8
+ import useWindowSize from "./useWindowSize.js";
9
+ export { useControlledOpenState, useCopy, useElementObserver, useEventListener, useOnClickOutside, usePrevious, useSelectAll, useWindowSize };
@@ -0,0 +1,91 @@
1
+ import { jsx, jsxs } from "react/jsx-runtime";
2
+ import { useEffect, useState } from "react";
3
+ import Button from "../components/Button/index.js";
4
+ import TextInput from "../components/Inputs/TextInput.js";
5
+ import Modal from "../components/Modal.js";
6
+ import useEventListener from "./useEventListener.js";
7
+ const useConfirm = ({ header = 'Do you want to proceed?', text, cancelText = 'Cancel', confirmText = 'Okay', negative, input, inputLabel, inputPlaceholder, inputValue } = {})=>{
8
+ const [inputText, setInputText] = useState(inputValue || '');
9
+ const [answer, setAnswer] = useState(null);
10
+ const close = ()=>setAnswer(null);
11
+ useEffect(()=>{
12
+ const haveValue = input && 'string' == typeof inputValue;
13
+ if (haveValue && inputText !== inputValue) setInputText(inputValue);
14
+ }, [
15
+ answer
16
+ ]);
17
+ const handleConfirm = ()=>{
18
+ answer?.resolve(input ? inputText : true);
19
+ close();
20
+ };
21
+ const handleCancel = ()=>{
22
+ answer?.resolve(false);
23
+ close();
24
+ };
25
+ const handleKeyPress = (event)=>{
26
+ const { key } = event;
27
+ switch(key){
28
+ case 'Enter':
29
+ handleConfirm();
30
+ break;
31
+ case 'Escape':
32
+ handleCancel();
33
+ break;
34
+ default:
35
+ break;
36
+ }
37
+ };
38
+ useEventListener(document, 'keydown', handleKeyPress, !!answer, [
39
+ inputText
40
+ ]);
41
+ const confirm = ()=>new Promise((resolve)=>{
42
+ setAnswer({
43
+ resolve
44
+ });
45
+ });
46
+ const ConfirmModal = ()=>/*#__PURE__*/ jsxs(Modal, {
47
+ visible: !!answer,
48
+ onClose: close,
49
+ width: 400,
50
+ children: [
51
+ header && /*#__PURE__*/ jsx(Modal.Header, {
52
+ children: header
53
+ }),
54
+ text && /*#__PURE__*/ jsx(Modal.Text, {
55
+ children: text
56
+ }),
57
+ input && /*#__PURE__*/ jsx(Modal.Body, {
58
+ marginTop: 4,
59
+ marginBottom: 8,
60
+ children: /*#__PURE__*/ jsx(TextInput, {
61
+ autoFocus: true,
62
+ label: inputLabel,
63
+ placeholder: inputPlaceholder,
64
+ value: inputText,
65
+ onChange: setInputText
66
+ })
67
+ }),
68
+ /*#__PURE__*/ jsxs(Modal.Footer, {
69
+ children: [
70
+ /*#__PURE__*/ jsx(Button, {
71
+ secondary: true,
72
+ marginRight: 8,
73
+ onClick: handleCancel,
74
+ children: cancelText
75
+ }),
76
+ /*#__PURE__*/ jsx(Button, {
77
+ negative: negative,
78
+ onClick: handleConfirm,
79
+ children: confirmText
80
+ })
81
+ ]
82
+ })
83
+ ]
84
+ });
85
+ return [
86
+ confirm,
87
+ ConfirmModal
88
+ ];
89
+ };
90
+ const hooks_useConfirm = useConfirm;
91
+ export { hooks_useConfirm as default };
@@ -0,0 +1,22 @@
1
+ import { useEffect, useState } from "react";
2
+ const useControlledOpenState_useControlledOpenState = ({ open, onOpenChange, afterShow, afterHide })=>{
3
+ const [isOpen, setIsOpen] = useState(false);
4
+ useEffect(()=>{
5
+ if (void 0 !== open && open !== isOpen) setIsOpen(open);
6
+ }, [
7
+ open,
8
+ isOpen
9
+ ]);
10
+ const handleOpenChange = (show)=>{
11
+ if (void 0 === open) setIsOpen(show);
12
+ if (onOpenChange) onOpenChange(show);
13
+ if (show && afterShow) afterShow();
14
+ if (!show && afterHide) afterHide();
15
+ };
16
+ return [
17
+ isOpen,
18
+ handleOpenChange
19
+ ];
20
+ };
21
+ const useControlledOpenState = useControlledOpenState_useControlledOpenState;
22
+ export { useControlledOpenState as default };
@@ -0,0 +1,28 @@
1
+ import { useCallback, useState } from "react";
2
+ import copyToClipboard from "../utils/copyToClipboard.js";
3
+ const useCopy = (delay = 2000, resetDelay = 2000)=>{
4
+ const [isCopying, setIsCopying] = useState(false);
5
+ const [isCopied, setIsCopied] = useState(false);
6
+ const copy = useCallback((text)=>{
7
+ if (isCopying) return;
8
+ copyToClipboard(text);
9
+ setIsCopying(true);
10
+ setTimeout(()=>{
11
+ setIsCopying(false);
12
+ setIsCopied(true);
13
+ setTimeout(()=>{
14
+ setIsCopied(false);
15
+ }, resetDelay);
16
+ }, delay);
17
+ }, [
18
+ delay,
19
+ isCopying
20
+ ]);
21
+ return {
22
+ copy,
23
+ isCopying,
24
+ isCopied
25
+ };
26
+ };
27
+ const hooks_useCopy = useCopy;
28
+ export { hooks_useCopy as default };
@@ -0,0 +1,6 @@
1
+ import resize_observer from "@react-hook/resize-observer";
2
+ const useElementObserver = (target, callback)=>{
3
+ resize_observer(target, (entry)=>callback(entry.target));
4
+ };
5
+ const hooks_useElementObserver = useElementObserver;
6
+ export { hooks_useElementObserver as default };
@@ -0,0 +1,19 @@
1
+ import { useEffect } from "react";
2
+ const useEventListener = (element, type, listener, condition, dependencies = [])=>{
3
+ useEffect(()=>{
4
+ if (!element || 'current' in element && !element.current) return ()=>null;
5
+ let el;
6
+ el = 'current' in element ? element.current : element;
7
+ const removeListener = ()=>el.removeEventListener(type, listener, false);
8
+ if (false !== condition) el.addEventListener(type, listener, false);
9
+ else removeListener();
10
+ return removeListener;
11
+ }, [
12
+ element,
13
+ type,
14
+ condition,
15
+ ...dependencies
16
+ ]);
17
+ };
18
+ const hooks_useEventListener = useEventListener;
19
+ export { hooks_useEventListener as default };
@@ -0,0 +1,21 @@
1
+ import { useRef } from "react";
2
+ import useEventListener from "./useEventListener.js";
3
+ const useOnClickOutside_useOnClickOutside = (onClickOutside, condition, exclusions)=>{
4
+ const ref = useRef(null);
5
+ const handleOutsideClick = (event)=>{
6
+ if (ref?.current && null !== event) {
7
+ const container = ref.current.contains(event.target);
8
+ if (!container) {
9
+ const excluded = exclusions?.length ? exclusions.join(', ') : '';
10
+ const target = event.target;
11
+ const excludedElement = target && excluded ? target.matches(excluded) : false;
12
+ if (!excluded || !excludedElement) onClickOutside();
13
+ }
14
+ }
15
+ };
16
+ useEventListener(document, 'mousedown', handleOutsideClick, condition);
17
+ useEventListener(document, 'touchstart', handleOutsideClick, condition);
18
+ return ref;
19
+ };
20
+ const useOnClickOutside = useOnClickOutside_useOnClickOutside;
21
+ export { useOnClickOutside as default };
@@ -0,0 +1,12 @@
1
+ import { useEffect, useRef } from "react";
2
+ const usePrevious = (value)=>{
3
+ const ref = useRef(value);
4
+ useEffect(()=>{
5
+ ref.current = value;
6
+ }, [
7
+ value
8
+ ]);
9
+ return ref.current;
10
+ };
11
+ const hooks_usePrevious = usePrevious;
12
+ export { hooks_usePrevious as default };
@@ -0,0 +1,60 @@
1
+ import { useEffect, useState } from "react";
2
+ const useSelectAll = (items, defaultSelected)=>{
3
+ const [list, setList] = useState([]);
4
+ const [allSelected, setAllSelected] = useState(defaultSelected || false);
5
+ const [partial, setPartial] = useState(false);
6
+ const [count, setCount] = useState(0);
7
+ useEffect(()=>{
8
+ if (items?.length) {
9
+ const newList = items.map((item)=>({
10
+ ...item,
11
+ selected: defaultSelected || false
12
+ }));
13
+ setList(newList);
14
+ }
15
+ }, []);
16
+ const onSelectAll = (selectAll)=>{
17
+ setList((prev)=>prev.map((item)=>({
18
+ ...item,
19
+ selected: selectAll
20
+ })));
21
+ };
22
+ const onChildChange = (val, id)=>{
23
+ setList((prev)=>prev.map((item)=>{
24
+ if (item.id === id) return {
25
+ ...item,
26
+ selected: val
27
+ };
28
+ return item;
29
+ }));
30
+ };
31
+ useEffect(()=>{
32
+ const allChildren = list.every((item)=>item.selected);
33
+ const someChildren = list.some((item)=>item.selected);
34
+ if (allChildren) {
35
+ setPartial(false);
36
+ setAllSelected(true);
37
+ setCount(list.length);
38
+ } else if (someChildren) {
39
+ setPartial(true);
40
+ setAllSelected(false);
41
+ setCount(list.filter((item)=>item.selected).length);
42
+ } else {
43
+ setPartial(false);
44
+ setAllSelected(false);
45
+ setCount(0);
46
+ }
47
+ }, [
48
+ list
49
+ ]);
50
+ return {
51
+ list,
52
+ partial,
53
+ allSelected,
54
+ count,
55
+ onSelectAll,
56
+ onChildChange
57
+ };
58
+ };
59
+ const hooks_useSelectAll = useSelectAll;
60
+ export { hooks_useSelectAll as default };
@@ -0,0 +1,25 @@
1
+ import { useEffect, useState } from "react";
2
+ const useWindowSize_useWindowSize = ()=>{
3
+ const initialState = {
4
+ width: null,
5
+ height: null
6
+ };
7
+ const [windowSize, setWindowSize] = useState(initialState);
8
+ useEffect(()=>{
9
+ const ssr = 'undefined' == typeof window;
10
+ const handleResize = ()=>{
11
+ if (ssr) return;
12
+ setWindowSize({
13
+ width: window.innerWidth,
14
+ height: window.innerHeight
15
+ });
16
+ };
17
+ if (!ssr) window.addEventListener('resize', handleResize);
18
+ const cleanup = ssr ? ()=>null : ()=>window.removeEventListener('resize', handleResize);
19
+ handleResize();
20
+ return cleanup;
21
+ }, []);
22
+ return windowSize;
23
+ };
24
+ const useWindowSize = useWindowSize_useWindowSize;
25
+ export { useWindowSize as default };
package/build/index.d.ts CHANGED
@@ -85,5 +85,6 @@ export { default as useCopy } from './hooks/useCopy';
85
85
  export { marginProps, paddingProps, positionProps, widthHeightProps } from './components/helpers/styledProps';
86
86
  export { default as copyToClipboard } from './utils/copyToClipboard';
87
87
  export { default as formatDate } from './utils/formatDate';
88
+ export { default as formatNumber } from './utils/formatNumber';
88
89
  export { default as numberWithCommas } from './utils/numberWithCommas';
89
90
  export { createEditorContent, editorContentToText } from './components/Editor';
package/build/index.js CHANGED
@@ -75,5 +75,6 @@ import useCopy from "./hooks/useCopy.js";
75
75
  import { marginProps, paddingProps, positionProps, widthHeightProps } from "./components/helpers/styledProps.js";
76
76
  import copyToClipboard from "./utils/copyToClipboard.js";
77
77
  import formatDate from "./utils/formatDate.js";
78
+ import formatNumber from "./utils/formatNumber.js";
78
79
  import numberWithCommas from "./utils/numberWithCommas.js";
79
- export { Accordion, Audio, BarChart, Button, Calendar, Checkbox, Code, ComboBox, CommandMenu, DatePicker, DateRangePicker, DateRangeSelect, DocTable, Dot, DraftEditor, Dropdown, DropdownMenu, DropdownSelect, Editor, Ellipsis, Form, Grid, Icon, ImageViewer, InlineCode, InlineInput, InputHelpers as InputUtils, Label, LineChart, Menu, Message, MessageHr, Modal, MultiSelect, NumberInput, Pagination, PhoneInput, PieChart, Popover, PortalScope, Progress, Radio, RangeCalendar, ResetStyles, ScrollbarStyles, SearchInput, Select, Slider, Spinner, Table, Tabs, Tag, TextArea, TextInput, TimeInput, ToastStyles, Toggle, ToggleButton, ToggleButtonGroup, Tooltip, TransferList, Tree, UnstyledButton, colors, copyToClipboard, createEditorContent, darkScale, editorContentToText, formatDate, lightScale, marginProps, numberWithCommas, paddingProps, positionProps, theme, themeClasses, themeOptions, useConfirm, useCopy, useElementObserver, useEventListener, useOnClickOutside, usePrevious, useSelectAll, useWindowSize, widthHeightProps };
80
+ export { Accordion, Audio, BarChart, Button, Calendar, Checkbox, Code, ComboBox, CommandMenu, DatePicker, DateRangePicker, DateRangeSelect, DocTable, Dot, DraftEditor, Dropdown, DropdownMenu, DropdownSelect, Editor, Ellipsis, Form, Grid, Icon, ImageViewer, InlineCode, InlineInput, InputHelpers as InputUtils, Label, LineChart, Menu, Message, MessageHr, Modal, MultiSelect, NumberInput, Pagination, PhoneInput, PieChart, Popover, PortalScope, Progress, Radio, RangeCalendar, ResetStyles, ScrollbarStyles, SearchInput, Select, Slider, Spinner, Table, Tabs, Tag, TextArea, TextInput, TimeInput, ToastStyles, Toggle, ToggleButton, ToggleButtonGroup, Tooltip, TransferList, Tree, UnstyledButton, colors, copyToClipboard, createEditorContent, darkScale, editorContentToText, formatDate, formatNumber, lightScale, marginProps, numberWithCommas, paddingProps, positionProps, theme, themeClasses, themeOptions, useConfirm, useCopy, useElementObserver, useEventListener, useOnClickOutside, usePrevious, useSelectAll, useWindowSize, widthHeightProps };
File without changes
@@ -0,0 +1,33 @@
1
+ import common from "./common.js";
2
+ const { font } = common;
3
+ const common_button = {
4
+ tiny: {
5
+ height: 18,
6
+ iconSize: 12,
7
+ font: font.size.xs,
8
+ padding: 4,
9
+ iconOnlyPadding: 2
10
+ },
11
+ small: {
12
+ height: 28,
13
+ iconSize: 18,
14
+ font: font.size.sm,
15
+ padding: 10,
16
+ iconOnlyPadding: 5
17
+ },
18
+ medium: {
19
+ height: 32,
20
+ iconSize: 22,
21
+ font: font.size.md,
22
+ padding: 12,
23
+ iconOnlyPadding: 5
24
+ },
25
+ large: {
26
+ height: 36,
27
+ iconSize: 24,
28
+ font: font.size.lg,
29
+ padding: 14,
30
+ iconOnlyPadding: 6
31
+ }
32
+ };
33
+ export { common_button as default };
@@ -0,0 +1,38 @@
1
+ import colors from "../core/colors.js";
2
+ const common = {
3
+ color: colors,
4
+ elevation0: '0px 2px 4px 2px rgba(0, 0, 0, 0.05)',
5
+ elevation1: '0px 2px 4px 2px rgba(0, 0, 0, 0.1)',
6
+ elevation2: '0px 2px 4px 2px rgba(0, 0, 0, 0.15)',
7
+ elevation3: '0px 4px 8px 2px rgba(0, 0, 0, 0.2)',
8
+ elevation4: '0px 4px 8px 2px rgba(0, 0, 0, 0.25)',
9
+ font: {
10
+ weight: {
11
+ thin: 100,
12
+ light: 300,
13
+ default: 400,
14
+ medium: 500,
15
+ semiBold: 600,
16
+ bold: 700
17
+ },
18
+ size: {
19
+ xs: 10,
20
+ sm: 12,
21
+ md: 14,
22
+ lg: 16,
23
+ xl: 18
24
+ },
25
+ family: {
26
+ default: "'Roboto', sans-serif",
27
+ medium: "'Roboto', sans-serif",
28
+ light: "'Roboto', sans-serif"
29
+ }
30
+ },
31
+ size: {
32
+ xs: 4,
33
+ sm: 8,
34
+ md: 16,
35
+ lg: 24
36
+ }
37
+ };
38
+ export { common as default };
@@ -0,0 +1,4 @@
1
+ import common from "./common.js";
2
+ import button_0 from "./button.js";
3
+ const theme_common = common;
4
+ export { button_0 as button, theme_common as default };