@wavv/ui 2.2.2-alpha.5 → 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 (229) 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/theme/ThemeTypes.js +0 -0
  208. package/build/theme/common/button.js +33 -0
  209. package/build/theme/common/common.js +38 -0
  210. package/build/theme/common/index.js +4 -0
  211. package/build/theme/core/colors.js +77 -0
  212. package/build/theme/core/dark/dark.js +457 -0
  213. package/build/theme/core/dark/darkScale.js +36 -0
  214. package/build/theme/core/light/light.js +456 -0
  215. package/build/theme/core/light/lightScale.js +35 -0
  216. package/build/theme/eighties/colors.js +78 -0
  217. package/build/theme/eighties/dark/dark.js +457 -0
  218. package/build/theme/eighties/dark/darkScale.js +36 -0
  219. package/build/theme/eighties/light/light.js +456 -0
  220. package/build/theme/eighties/light/lightScale.js +35 -0
  221. package/build/theme/index.js +28 -0
  222. package/build/utils/chunk.js +13 -0
  223. package/build/utils/copyToClipboard.js +29 -0
  224. package/build/utils/flattenListOptions.js +4 -0
  225. package/build/utils/formatDate.js +55 -0
  226. package/build/utils/index.js +6 -0
  227. package/build/utils/numberWithCommas.js +3 -0
  228. package/build/utils/range.js +11 -0
  229. package/package.json +1 -1
@@ -0,0 +1,213 @@
1
+ const validateField = (testField, fields, displayValue)=>{
2
+ const field = fields.find(({ id })=>id === testField.id);
3
+ const composeMode = fields.every((item)=>!item.value);
4
+ const someFieldsHaveValues = fields.some((item)=>item.value);
5
+ let isValid = true;
6
+ let entityLabel = '';
7
+ if (field) {
8
+ if (composeMode) isValid = true;
9
+ else if ((displayValue || someFieldsHaveValues) && !field?.value) isValid = false;
10
+ } else isValid = false;
11
+ entityLabel = isValid ? displayValue && !composeMode ? field?.value || '' : field?.label || '' : field?.id || testField.id;
12
+ const label = displayValue && field?.value ? entityLabel : `{${entityLabel}}`;
13
+ return {
14
+ label,
15
+ isValid
16
+ };
17
+ };
18
+ const parseTextToDocument = (text, fields, displayValue)=>{
19
+ const parts = text.replace(/(<<\w+?>>)/g, '~~$1~~').split('~~');
20
+ const content = [];
21
+ for (const part of parts)if (part.startsWith('<<') && part.endsWith('>>')) {
22
+ const id = part.replace(/<<|>>/g, '');
23
+ const field = fields?.find((item)=>item.id === id);
24
+ const fieldToValidate = field || {
25
+ id,
26
+ label: ''
27
+ };
28
+ const { label, isValid } = validateField(fieldToValidate, fields || [], displayValue);
29
+ content.push({
30
+ type: 'mergeField',
31
+ attrs: {
32
+ id,
33
+ label,
34
+ isValid,
35
+ displayValue
36
+ }
37
+ });
38
+ } else if (part) {
39
+ const lines = part.split('\n');
40
+ for(let i = 0; i < lines.length; i++){
41
+ if (lines[i] || 0 === i) {
42
+ if (lines[i]) content.push({
43
+ type: 'text',
44
+ text: lines[i]
45
+ });
46
+ }
47
+ if (i < lines.length - 1) content.push({
48
+ type: 'hardBreak'
49
+ });
50
+ }
51
+ }
52
+ if (0 === content.length) return {
53
+ type: 'doc',
54
+ content: [
55
+ {
56
+ type: 'paragraph',
57
+ content: []
58
+ }
59
+ ]
60
+ };
61
+ return {
62
+ type: 'doc',
63
+ content: [
64
+ {
65
+ type: 'paragraph',
66
+ content
67
+ }
68
+ ]
69
+ };
70
+ };
71
+ const documentToText = (editor)=>{
72
+ const doc = editor.getJSON();
73
+ return extractTextFromDocument(doc);
74
+ };
75
+ const documentToJSON = (editor)=>editor.getJSON();
76
+ const documentToHTML = (editor)=>editor.getHTML();
77
+ const documentToMarkdown = (editor)=>{
78
+ const doc = editor.getJSON();
79
+ return extractMarkdownFromDocument(doc);
80
+ };
81
+ const editorContentToText = (json)=>extractTextFromDocument(json);
82
+ const getEditorCharacterCount = (editor)=>{
83
+ const doc = editor.getJSON();
84
+ return countCharactersInDocument(doc);
85
+ };
86
+ const countCharactersInDocument = (node)=>{
87
+ let count = 0;
88
+ if ('mergeField' === node.type) count += (node.attrs?.label || '').length;
89
+ else if ('text' === node.type) count += (node.text || '').length;
90
+ else if ('hardBreak' === node.type) count += 1;
91
+ else if (node.content) for (const child of node.content)count += countCharactersInDocument(child);
92
+ return count;
93
+ };
94
+ const extractTextFromDocument = (node)=>{
95
+ let text = '';
96
+ if ('mergeField' === node.type) text += `<<${node.attrs?.id}>>`;
97
+ else if ('text' === node.type) text += node.text || '';
98
+ else if ('hardBreak' === node.type) text += '\n';
99
+ else if (node.content) {
100
+ for (const child of node.content)text += extractTextFromDocument(child);
101
+ 'paragraph' === node.type && node.content.length;
102
+ }
103
+ return text;
104
+ };
105
+ const extractMarkdownFromDocument = (node)=>{
106
+ let text = '';
107
+ if ('mergeField' === node.type) text += `<<${node.attrs?.id}>>`;
108
+ else if ('text' === node.type) {
109
+ let textContent = node.text || '';
110
+ if (node.marks) for (const mark of node.marks)switch(mark.type){
111
+ case 'bold':
112
+ textContent = `**${textContent}**`;
113
+ break;
114
+ case 'italic':
115
+ textContent = `*${textContent}*`;
116
+ break;
117
+ case 'strike':
118
+ textContent = `~~${textContent}~~`;
119
+ break;
120
+ case 'code':
121
+ textContent = `\`${textContent}\``;
122
+ break;
123
+ }
124
+ text += textContent;
125
+ } else if ('hardBreak' === node.type) text += '\n';
126
+ else if (node.content) {
127
+ for (const child of node.content)text += extractMarkdownFromDocument(child);
128
+ if ('paragraph' === node.type && node.content && node.content.length > 0) text += '\n\n';
129
+ }
130
+ return text;
131
+ };
132
+ const parseJSONToDocument = (jsonContent, fields, displayValue)=>{
133
+ const validateNode = (node)=>{
134
+ if ('mergeField' === node.type) {
135
+ const field = fields?.find((item)=>item.id === node.attrs.id);
136
+ const fieldToValidate = field || {
137
+ id: node.attrs.id,
138
+ label: ''
139
+ };
140
+ const { label, isValid } = validateField(fieldToValidate, fields || [], displayValue);
141
+ return {
142
+ ...node,
143
+ attrs: {
144
+ ...node.attrs,
145
+ label,
146
+ isValid,
147
+ displayValue
148
+ }
149
+ };
150
+ }
151
+ if (node.content) return {
152
+ ...node,
153
+ content: node.content.map(validateNode)
154
+ };
155
+ return node;
156
+ };
157
+ return validateNode(jsonContent);
158
+ };
159
+ const getEditorContent = (editor, mergeFields)=>({
160
+ text: documentToText(editor),
161
+ json: documentToJSON(editor),
162
+ html: documentToHTML(editor),
163
+ markdown: documentToMarkdown(editor),
164
+ hasMissingFields: hasMissingFields(editor, mergeFields)
165
+ });
166
+ const hasMissingFields = (editor, fields)=>{
167
+ const doc = editor.getJSON();
168
+ return checkForMissingFields(doc, fields);
169
+ };
170
+ const checkForMissingFields = (node, fields)=>{
171
+ if ('mergeField' === node.type) return !node.attrs.isValid;
172
+ if (node.content) return node.content.some((child)=>checkForMissingFields(child, fields));
173
+ return false;
174
+ };
175
+ const updateMergeFieldValidation = (editor, fields, displayValue)=>{
176
+ const { state, view } = editor;
177
+ const { tr } = state;
178
+ let hasChanges = false;
179
+ state.doc.descendants((node, pos)=>{
180
+ if ('mergeField' === node.type.name) {
181
+ const { id } = node.attrs;
182
+ const field = fields?.find((item)=>item.id === id);
183
+ const fieldToValidate = field || {
184
+ id,
185
+ label: ''
186
+ };
187
+ const { label, isValid } = validateField(fieldToValidate, fields || [], displayValue);
188
+ if (node.attrs.isValid !== isValid || node.attrs.label !== label || node.attrs.displayValue !== displayValue) {
189
+ tr.setNodeMarkup(pos, void 0, {
190
+ ...node.attrs,
191
+ label,
192
+ isValid,
193
+ displayValue
194
+ });
195
+ hasChanges = true;
196
+ }
197
+ }
198
+ });
199
+ if (hasChanges) view.dispatch(tr);
200
+ };
201
+ const insertMergeField = (editor, field, fields, displayValue)=>{
202
+ const { label, isValid } = validateField(field, fields, displayValue);
203
+ editor.chain().focus().insertContent({
204
+ type: 'mergeField',
205
+ attrs: {
206
+ id: field.id,
207
+ label,
208
+ isValid,
209
+ displayValue
210
+ }
211
+ }).run();
212
+ };
213
+ export { documentToHTML, documentToJSON, documentToMarkdown, documentToText, editorContentToText, getEditorCharacterCount, getEditorContent, hasMissingFields, insertMergeField, parseJSONToDocument, parseTextToDocument, updateMergeFieldValidation, validateField };
@@ -0,0 +1,3 @@
1
+ import Editor, { createEditorContent } from "./Editor.js";
2
+ import { editorContentToText } from "./editorUtils.js";
3
+ export { createEditorContent, Editor as default, editorContentToText };
@@ -0,0 +1,22 @@
1
+ import { jsx } from "react/jsx-runtime";
2
+ import styled from "@emotion/styled";
3
+ import { marginProps, paddingProps } from "./helpers/styledProps.js";
4
+ const Ellipsis = ({ children, ...props })=>/*#__PURE__*/ jsx(EllipsisContainer, {
5
+ ...props,
6
+ children: children
7
+ });
8
+ const EllipsisContainer = styled.div(({ clampLines })=>({
9
+ overflow: 'hidden',
10
+ textOverflow: 'ellipsis',
11
+ whiteSpace: clampLines ? void 0 : 'nowrap',
12
+ WebkitLineClamp: clampLines,
13
+ display: clampLines ? '-webkit-box' : void 0,
14
+ WebkitBoxOrient: clampLines ? 'vertical' : void 0,
15
+ wordBreak: clampLines ? 'break-word' : void 0
16
+ }), ({ width })=>({
17
+ width: width || 'auto'
18
+ }), ({ textAlign })=>({
19
+ textAlign: textAlign || 'left'
20
+ }), paddingProps, marginProps);
21
+ const components_Ellipsis = Ellipsis;
22
+ export { components_Ellipsis as default };
@@ -0,0 +1,20 @@
1
+ import { jsx } from "react/jsx-runtime";
2
+ import styled from "@emotion/styled";
3
+ import { useRef } from "react";
4
+ import { useFocusable } from "react-aria";
5
+ const Focusable_Focusable = ({ children, ref, ...props })=>{
6
+ const backupRef = useRef(null);
7
+ const determinedRef = ref || backupRef;
8
+ const { focusableProps } = useFocusable(props, determinedRef);
9
+ return /*#__PURE__*/ jsx(Trigger, {
10
+ ref: determinedRef,
11
+ ...focusableProps,
12
+ ...props,
13
+ children: children
14
+ });
15
+ };
16
+ const Trigger = styled.span({
17
+ display: 'grid'
18
+ });
19
+ const Focusable = Focusable_Focusable;
20
+ export { Focusable as default };
@@ -0,0 +1,68 @@
1
+ import { jsx } from "react/jsx-runtime";
2
+ import styled from "@emotion/styled";
3
+ import Checkbox from "./Checkbox.js";
4
+ import Grid from "./Grid.js";
5
+ import { marginProps } from "./helpers/styledProps.js";
6
+ import Label from "./Label.js";
7
+ import Radio from "./Radio.js";
8
+ import Toggle from "./Toggle.js";
9
+ const Form_Form = ({ children, rows, columns, rowGap, columnGap, onSubmit, ...rest })=>{
10
+ const handleSubmit = (event)=>{
11
+ event.preventDefault();
12
+ if (onSubmit) onSubmit(event);
13
+ };
14
+ return /*#__PURE__*/ jsx(FormContainer, {
15
+ as: "form",
16
+ rows: rows,
17
+ columns: columns,
18
+ rowGap: rowGap,
19
+ columnGap: columnGap,
20
+ onSubmit: handleSubmit,
21
+ ...rest,
22
+ children: children
23
+ });
24
+ };
25
+ Form_Form.Group = ({ children, rows, columns, rowGap, columnGap, disabled, ...rest })=>/*#__PURE__*/ jsx(FormGroup, {
26
+ rows: rows,
27
+ columns: columns,
28
+ rowGap: rowGap,
29
+ columnGap: columnGap,
30
+ disabled: disabled,
31
+ ...rest,
32
+ children: children
33
+ });
34
+ Form_Form.Field = ({ children, inline, align, disabled, ...props })=>/*#__PURE__*/ jsx(FormField, {
35
+ ...props,
36
+ inline: inline,
37
+ align: align,
38
+ disabled: disabled,
39
+ children: children
40
+ });
41
+ Form_Form.Radio = Radio;
42
+ Form_Form.Toggle = Toggle;
43
+ Form_Form.Checkbox = Checkbox;
44
+ Form_Form.Label = Label;
45
+ const FormContainer = styled(Grid)({
46
+ boxSizing: 'border-box'
47
+ });
48
+ const FormGroup = styled(Grid)(({ disabled })=>disabled && {
49
+ opacity: 0.3,
50
+ pointerEvents: 'none'
51
+ });
52
+ const FormField = styled.div(({ inline, align })=>{
53
+ const alignOptions = {
54
+ top: 'flex-start',
55
+ bottom: 'flex-end',
56
+ center: 'center'
57
+ };
58
+ return {
59
+ display: 'flex',
60
+ flexDirection: inline ? 'row' : 'column',
61
+ alignItems: align ? alignOptions[align] : void 0
62
+ };
63
+ }, ({ disabled })=>disabled && {
64
+ opacity: 0.3,
65
+ pointerEvents: 'none'
66
+ }, marginProps);
67
+ const Form = Form_Form;
68
+ export { Form as default };
@@ -0,0 +1,72 @@
1
+ import styled from "@emotion/styled";
2
+ import { darken, lighten } from "polished";
3
+ import { marginProps } from "./helpers/styledProps.js";
4
+ const ControlContainer = styled.label(({ theme: { formControl, name }, labelRight, disabled, readOnly, iconColor })=>{
5
+ const adjustBgColor = 'dark' === name ? darken : lighten;
6
+ const hoverColor = iconColor ? adjustBgColor(0.05, iconColor) : formControl.color.hover;
7
+ const activeHoverColor = iconColor ? adjustBgColor(0.1, iconColor) : formControl.color.activeHover;
8
+ return {
9
+ display: 'inline-flex',
10
+ flexDirection: labelRight ? 'row-reverse' : 'row',
11
+ justifyContent: labelRight ? 'flex-end' : 'flex-start',
12
+ alignItems: 'center',
13
+ position: 'relative',
14
+ cursor: disabled ? 'not-allowed' : readOnly ? 'default' : void 0,
15
+ pointerEvents: readOnly ? 'none' : void 0,
16
+ '&:hover > div': {
17
+ color: disabled || readOnly ? void 0 : hoverColor
18
+ },
19
+ '&:hover > input:checked + div': {
20
+ color: disabled || readOnly ? void 0 : activeHoverColor
21
+ }
22
+ };
23
+ }, marginProps);
24
+ const ControlInput = styled.input({
25
+ border: 0,
26
+ clip: 'rect(0, 0, 0, 0)',
27
+ height: 1,
28
+ overflow: 'hidden',
29
+ padding: 0,
30
+ position: 'absolute',
31
+ whiteSpace: 'nowrap',
32
+ width: 1
33
+ }, ({ theme: { accent, formControl }, iconColor })=>({
34
+ '& + div': {
35
+ color: iconColor || formControl.color.default,
36
+ borderRadius: 4
37
+ },
38
+ '&[type="checkbox"] + div': {
39
+ transition: 'color 0.2s linear'
40
+ },
41
+ '&[type="radio"] + div > svg > svg > .radio-fill': {
42
+ opacity: 0
43
+ },
44
+ '&:checked': {
45
+ '& + div': {
46
+ color: iconColor || formControl.color.active
47
+ },
48
+ '&[type="radio"] + div > svg > svg > .radio-fill': {
49
+ opacity: 1
50
+ }
51
+ },
52
+ '&[type="checkbox"]:indeterminate + div': {
53
+ color: iconColor || formControl.color.active
54
+ },
55
+ '&:disabled': {
56
+ '& + div': {
57
+ color: formControl.color.disabled
58
+ }
59
+ },
60
+ '&:focus-visible': {
61
+ '& + div': {
62
+ outline: `${accent} solid 1px`,
63
+ outlineOffset: -1
64
+ }
65
+ }
66
+ }));
67
+ const ControlLabel = styled.span(({ theme: { font, scale10 } })=>({
68
+ fontSize: font.size.md,
69
+ color: scale10,
70
+ cursor: 'pointer'
71
+ }));
72
+ export { ControlContainer, ControlInput, ControlLabel };
@@ -0,0 +1,53 @@
1
+ import { jsx } from "react/jsx-runtime";
2
+ import styled from "@emotion/styled";
3
+ import { marginProps, paddingProps } from "./helpers/styledProps.js";
4
+ const StyledGrid = styled.div({
5
+ display: 'grid'
6
+ }, ({ rows, rowGap, columns, columnGap, gap, template, alignContent, alignItems, justifyContent, justifyItems, width, height })=>{
7
+ const isColNum = 'number' == typeof columns;
8
+ const isRowNum = 'number' == typeof rows;
9
+ return {
10
+ gridTemplateColumns: isColNum ? `repeat(${columns}, 1fr)` : columns,
11
+ gridTemplateRows: isRowNum ? `repeat(${rows}, 1fr)` : rows,
12
+ gridColumnGap: columnGap,
13
+ gridRowGap: rowGap,
14
+ gridGap: gap,
15
+ gridTemplate: template,
16
+ alignItems,
17
+ justifyItems,
18
+ alignContent,
19
+ justifyContent,
20
+ width,
21
+ height
22
+ };
23
+ }, ({ columns })=>'equal' === columns && {
24
+ gridTemplateColumns: 'unset',
25
+ gridAutoColumns: '1fr',
26
+ gridAutoFlow: 'column'
27
+ }, paddingProps, marginProps);
28
+ const GridItem = styled.div(({ row, rowStart, rowEnd, column, columnStart, columnEnd, area, alignSelf, justifySelf, placeSelf, border })=>({
29
+ gridRow: row,
30
+ gridRowStart: rowStart,
31
+ gridRowEnd: rowEnd,
32
+ gridColumn: column,
33
+ gridColumnStart: columnStart,
34
+ gridColumnEnd: columnEnd,
35
+ gridArea: area,
36
+ alignSelf,
37
+ justifySelf,
38
+ placeSelf,
39
+ border
40
+ }), paddingProps, marginProps);
41
+ const Grid_Grid = ({ children, ...props })=>/*#__PURE__*/ jsx(StyledGrid, {
42
+ ...props,
43
+ children: children
44
+ });
45
+ const Item = ({ children, ...props })=>/*#__PURE__*/ jsx(GridItem, {
46
+ ...props,
47
+ children: children
48
+ });
49
+ Item.displayName = 'Grid.Item';
50
+ const Grid = Object.assign(Grid_Grid, {
51
+ Item
52
+ });
53
+ export { Item, Grid as default };
@@ -0,0 +1,89 @@
1
+ import { jsx } from "react/jsx-runtime";
2
+ import styled from "@emotion/styled";
3
+ import { cloneElement } from "react";
4
+ import DynamicIcon from "../DynamicIcon.js";
5
+ import { marginProps } from "../helpers/styledProps.js";
6
+ import customIcons from "./customIcons.js";
7
+ import icons from "./icons.js";
8
+ const Icon = ({ name, svg, external, size, width, height, color, hoverColor, pointer = false, animation, style, onClick, ref, ...props })=>{
9
+ let SvgComponent = null;
10
+ let svgContent = null;
11
+ let iconName;
12
+ if (name) {
13
+ if (name in customIcons) SvgComponent = customIcons[name];
14
+ else if (name in icons) iconName = icons[name];
15
+ } else if (svg) {
16
+ let element = svg;
17
+ if ('function' == typeof svg) element = svg();
18
+ const clonedSvg = /*#__PURE__*/ cloneElement(element, {
19
+ width: width || size,
20
+ height: height || size
21
+ });
22
+ svgContent = clonedSvg;
23
+ }
24
+ const iconSizes = {
25
+ tiny: 12,
26
+ small: 18,
27
+ medium: 24,
28
+ large: 40
29
+ };
30
+ let iconSize = 'number' == typeof size ? size : iconSizes.medium;
31
+ if ('tiny' === size || 'small' === size || 'medium' === size || 'large' === size) iconSize = iconSizes[size];
32
+ const finalLucideName = external ?? iconName;
33
+ if (!SvgComponent && finalLucideName) return /*#__PURE__*/ jsx(DynamicIcon, {
34
+ ...props,
35
+ name: finalLucideName,
36
+ size: iconSize,
37
+ pointer: pointer,
38
+ hoverColor: hoverColor,
39
+ color: color,
40
+ style: style,
41
+ onClick: onClick,
42
+ tabIndex: onClick ? 0 : void 0,
43
+ animation: animation,
44
+ ref: ref
45
+ });
46
+ return SvgComponent || svgContent ? /*#__PURE__*/ jsx(IconWrapper, {
47
+ pointer: pointer,
48
+ hoverColor: hoverColor,
49
+ color: color,
50
+ style: style,
51
+ onClick: onClick,
52
+ as: onClick ? 'button' : void 0,
53
+ tabIndex: onClick ? 0 : -1,
54
+ animation: animation,
55
+ ref: ref,
56
+ ...props,
57
+ children: /*#__PURE__*/ jsx(Svg, {
58
+ size: iconSize,
59
+ width: width,
60
+ height: height,
61
+ xmlns: "http://www.w3.org/2000/svg",
62
+ children: SvgComponent ? /*#__PURE__*/ jsx(SvgComponent, {}) : svgContent
63
+ })
64
+ }) : null;
65
+ };
66
+ const Svg = styled.svg(({ size, width, height })=>({
67
+ width: width || size,
68
+ height: height || size
69
+ }));
70
+ const IconWrapper = styled.div(({ theme, color, pointer, hoverColor, animation })=>({
71
+ width: 'max-content',
72
+ height: 'max-content',
73
+ display: 'flex',
74
+ color: color || 'inherit',
75
+ cursor: pointer ? 'pointer' : void 0,
76
+ border: 'none',
77
+ backgroundColor: 'transparent',
78
+ padding: 0,
79
+ animation,
80
+ '&:hover': {
81
+ color: hoverColor || void 0
82
+ },
83
+ '&:focus-visible': {
84
+ outline: `${theme.accent} solid 1px`,
85
+ outlineOffset: -1
86
+ }
87
+ }), marginProps);
88
+ const Icon_Icon = Icon;
89
+ export { Icon_Icon as default };
@@ -0,0 +1,48 @@
1
+ import CaretDown from "../../assets/icons/CaretDown.js";
2
+ import CaretUp from "../../assets/icons/CaretUp.js";
3
+ import Dialpad from "../../assets/icons/Dialpad.js";
4
+ import Exclamation from "../../assets/icons/Exclamation.js";
5
+ import Phone from "../../assets/icons/Phone.js";
6
+ import PhoneAdd from "../../assets/icons/PhoneAdd.js";
7
+ import PhoneBlocked from "../../assets/icons/PhoneBlocked.js";
8
+ import PhoneCallback from "../../assets/icons/PhoneCallback.js";
9
+ import PhoneEnd from "../../assets/icons/PhoneEnd.js";
10
+ import PhoneForward from "../../assets/icons/PhoneForward.js";
11
+ import PhoneHistory from "../../assets/icons/PhoneHistory.js";
12
+ import PhoneHold from "../../assets/icons/PhoneHold.js";
13
+ import PhoneIncoming from "../../assets/icons/PhoneIncoming.js";
14
+ import PhoneMissed from "../../assets/icons/PhoneMissed.js";
15
+ import PhoneTalk from "../../assets/icons/PhoneTalk.js";
16
+ import PhoneTransfer from "../../assets/icons/PhoneTransfer.js";
17
+ import Record from "../../assets/icons/Record.js";
18
+ import Screenshot from "../../assets/icons/Screenshot.js";
19
+ import ShieldWavv from "../../assets/icons/ShieldWavv.js";
20
+ import Spotify from "../../assets/icons/Spotify.js";
21
+ import SubArrow from "../../assets/icons/SubArrow.js";
22
+ import TransferCancel from "../../assets/icons/TransferCancel.js";
23
+ const customIcons_customIcons = {
24
+ 'caret-down': CaretDown,
25
+ 'caret-up': CaretUp,
26
+ dialpad: Dialpad,
27
+ exclamation: Exclamation,
28
+ phone: Phone,
29
+ 'phone-add': PhoneAdd,
30
+ 'phone-blocked': PhoneBlocked,
31
+ 'phone-callback': PhoneCallback,
32
+ 'phone-end': PhoneEnd,
33
+ 'phone-forward': PhoneForward,
34
+ 'phone-history': PhoneHistory,
35
+ 'phone-hold': PhoneHold,
36
+ 'phone-incoming': PhoneIncoming,
37
+ 'phone-missed': PhoneMissed,
38
+ 'phone-talk': PhoneTalk,
39
+ 'phone-transfer': PhoneTransfer,
40
+ record: Record,
41
+ screenshot: Screenshot,
42
+ 'shield-wavv': ShieldWavv,
43
+ spotify: Spotify,
44
+ 'sub-arrow': SubArrow,
45
+ 'transfer-cancel': TransferCancel
46
+ };
47
+ const customIcons = customIcons_customIcons;
48
+ export { customIcons as default };