@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,84 @@
1
+ import { Fragment, jsx, jsxs } from "react/jsx-runtime";
2
+ import styled from "@emotion/styled";
3
+ import { useContext, useEffect } from "react";
4
+ import { Row } from "react-aria-components";
5
+ import mergePadding from "../helpers/mergePadding.js";
6
+ import Cell from "./Cell.js";
7
+ import Check from "./Check.js";
8
+ import context from "./context.js";
9
+ const Row_Row = ({ children, onClick, disabled, padding, paddingTop, paddingRight, paddingBottom, paddingLeft, ...rest })=>{
10
+ const { setRowPadding, selectionMode } = useContext(context);
11
+ useEffect(()=>{
12
+ const values = padding ?? paddingTop ?? paddingRight ?? paddingBottom ?? paddingLeft;
13
+ if (null != values && setRowPadding) {
14
+ const paddingValues = mergePadding({
15
+ padding,
16
+ paddingTop,
17
+ paddingRight,
18
+ paddingBottom,
19
+ paddingLeft
20
+ });
21
+ setRowPadding(paddingValues);
22
+ }
23
+ }, [
24
+ padding,
25
+ paddingTop,
26
+ paddingRight,
27
+ paddingBottom,
28
+ paddingLeft,
29
+ setRowPadding
30
+ ]);
31
+ const cellsToRender = selectionMode ? /*#__PURE__*/ jsxs(Fragment, {
32
+ children: [
33
+ /*#__PURE__*/ jsx(Cell, {
34
+ children: /*#__PURE__*/ jsx(Check, {
35
+ slot: "selection"
36
+ })
37
+ }),
38
+ children
39
+ ]
40
+ }) : children;
41
+ return /*#__PURE__*/ jsx(TableRow, {
42
+ isDisabled: disabled,
43
+ onAction: onClick && !disabled ? onClick : void 0,
44
+ hoverEffect: !!onClick && !disabled,
45
+ ...rest,
46
+ children: cellsToRender
47
+ });
48
+ };
49
+ const TableRow = styled(Row)(({ theme, backgroundColor, isDisabled })=>({
50
+ color: theme.table.color.body,
51
+ fontSize: theme.font.size.sm,
52
+ wordBreak: 'break-word',
53
+ opacity: isDisabled ? 0.3 : void 0,
54
+ backgroundColor,
55
+ outline: 'none',
56
+ transition: 'background-color 0.2s',
57
+ position: 'relative'
58
+ }), ({ theme, hoverEffect })=>hoverEffect && {
59
+ '&:hover': {
60
+ backgroundColor: theme.scale1,
61
+ cursor: 'pointer'
62
+ },
63
+ '&:focus-visible': {
64
+ backgroundColor: theme.scale1
65
+ }
66
+ }, ({ theme, emphasis })=>{
67
+ let borderLeftColor;
68
+ if (true === emphasis) borderLeftColor = theme.color.brand;
69
+ else if ('string' == typeof emphasis) borderLeftColor = emphasis;
70
+ return {
71
+ height: '100%',
72
+ '& > td:first-of-type > div': {
73
+ borderLeft: '2px solid transparent',
74
+ borderLeftColor
75
+ },
76
+ '&:not(:first-of-type) > td > div': {
77
+ borderTop: `1px solid ${theme.table.borderColor}`
78
+ }
79
+ };
80
+ }, ({ height })=>({
81
+ height
82
+ }));
83
+ const Table_Row = Row_Row;
84
+ export { Table_Row as default };
@@ -0,0 +1,24 @@
1
+ import { jsx, jsxs } from "react/jsx-runtime";
2
+ import { useTheme } from "@emotion/react";
3
+ const SortCaret = ({ sortDirection })=>{
4
+ const { color, scale4 } = useTheme();
5
+ const topColor = 'asc' === sortDirection ? color.brand : scale4;
6
+ const bottomColor = 'desc' === sortDirection ? color.brand : scale4;
7
+ return /*#__PURE__*/ jsxs("svg", {
8
+ viewBox: "0 0 24 24",
9
+ fill: "none",
10
+ xmlns: "http://www.w3.org/2000/svg",
11
+ children: [
12
+ /*#__PURE__*/ jsx("path", {
13
+ d: "M8.71005 14.71L11.3001 17.3C11.6901 17.69 12.3201 17.69 12.7101 17.3L15.3001 14.71C15.9301 14.08 15.4801 13 14.5901 13H9.41005C8.52005 13 8.08005 14.08 8.71005 14.71Z",
14
+ fill: bottomColor
15
+ }),
16
+ /*#__PURE__*/ jsx("path", {
17
+ d: "M8.71005 8.88253L11.3001 6.29253C11.6901 5.90253 12.3201 5.90253 12.7101 6.29253L15.3001 8.88253C15.9301 9.51253 15.4801 10.5925 14.5901 10.5925H9.41005C8.52005 10.5925 8.08005 9.51253 8.71005 8.88253Z",
18
+ fill: topColor
19
+ })
20
+ ]
21
+ });
22
+ };
23
+ const Table_SortCaret = SortCaret;
24
+ export { Table_SortCaret as default };
@@ -0,0 +1,88 @@
1
+ import { jsx } from "react/jsx-runtime";
2
+ import styled from "@emotion/styled";
3
+ import { orderBy } from "es-toolkit/compat";
4
+ import { isEqual } from "es-toolkit/predicate";
5
+ import { useEffect, useMemo, useState } from "react";
6
+ import { ResizableTableContainer, Table } from "react-aria-components";
7
+ import { marginProps, paddingProps } from "../helpers/styledProps.js";
8
+ import Body from "./Body.js";
9
+ import Cell from "./Cell.js";
10
+ import Column from "./Column.js";
11
+ import context from "./context.js";
12
+ import Header from "./Header.js";
13
+ import Row from "./Row.js";
14
+ const Table_Table = ({ children, data, backgroundColor, backgroundLevel, maxHeight, resizable, selectionMode, ...props })=>{
15
+ const [sorted, setSorted] = useState(data);
16
+ const [activeColumn, setActiveColumn] = useState();
17
+ const [headerPadding, setHeaderPadding] = useState();
18
+ const [rowPadding, setRowPadding] = useState();
19
+ const childrenToDisplay = data && 'function' == typeof children ? children(sorted) : children;
20
+ useEffect(()=>{
21
+ if (data) {
22
+ let newData = data;
23
+ if (activeColumn) {
24
+ const { key, dir } = activeColumn;
25
+ newData = orderBy(data, [
26
+ key
27
+ ], [
28
+ dir
29
+ ]);
30
+ }
31
+ if (!isEqual(newData, sorted)) setSorted(newData);
32
+ }
33
+ }, [
34
+ data,
35
+ activeColumn
36
+ ]);
37
+ const contextValue = useMemo(()=>({
38
+ activeColumn,
39
+ setActiveColumn,
40
+ headerPadding,
41
+ rowPadding,
42
+ setHeaderPadding,
43
+ setRowPadding,
44
+ selectionMode
45
+ }), [
46
+ activeColumn,
47
+ setActiveColumn,
48
+ headerPadding,
49
+ rowPadding,
50
+ setHeaderPadding,
51
+ setRowPadding,
52
+ selectionMode
53
+ ]);
54
+ return /*#__PURE__*/ jsx(context.Provider, {
55
+ value: contextValue,
56
+ children: /*#__PURE__*/ jsx(TableContainer, {
57
+ as: resizable ? ResizableTableContainer : void 0,
58
+ backgroundColor: backgroundColor,
59
+ backgroundLevel: backgroundLevel,
60
+ maxHeight: maxHeight,
61
+ children: /*#__PURE__*/ jsx(TableEl, {
62
+ selectionMode: selectionMode,
63
+ ...props,
64
+ children: childrenToDisplay
65
+ })
66
+ })
67
+ });
68
+ };
69
+ Table_Table.Header = Header;
70
+ Table_Table.Column = Column;
71
+ Table_Table.Body = Body;
72
+ Table_Table.Row = Row;
73
+ Table_Table.Cell = Cell;
74
+ const TableContainer = styled.div(({ theme, backgroundColor, maxHeight, backgroundLevel = 0 })=>({
75
+ overflow: 'auto',
76
+ position: 'relative',
77
+ width: '100%',
78
+ maxHeight: maxHeight || '100%',
79
+ borderRadius: 4,
80
+ backgroundColor: backgroundColor || theme.table.backgroundLevel[backgroundLevel]
81
+ }));
82
+ const TableEl = styled(Table)({
83
+ height: 'fit-content',
84
+ width: '100%',
85
+ backgroundColor: 'inherit'
86
+ }, marginProps, paddingProps);
87
+ const components_Table_Table = Table_Table;
88
+ export { components_Table_Table as default };
@@ -0,0 +1,20 @@
1
+ import { paddingProps } from "../helpers/styledProps.js";
2
+ const getPosition = (position)=>{
3
+ if (!position) return;
4
+ return 'start' === position || 'end' === position ? `flex-${position}` : position;
5
+ };
6
+ const baseStyles = ({ direction, justify, align = 'center', gap = 8 })=>({
7
+ display: 'flex',
8
+ justifyContent: getPosition(justify),
9
+ alignItems: getPosition(align),
10
+ flexDirection: direction,
11
+ width: '100%',
12
+ height: '100%',
13
+ gap
14
+ });
15
+ const contentStyles_contentStyles = [
16
+ baseStyles,
17
+ paddingProps
18
+ ];
19
+ const contentStyles = contentStyles_contentStyles;
20
+ export { contentStyles as default };
@@ -0,0 +1,4 @@
1
+ import { createContext } from "react";
2
+ const TableContext = createContext({});
3
+ const context = TableContext;
4
+ export { context as default };
@@ -0,0 +1,2 @@
1
+ import Table from "./Table.js";
2
+ export { Table as default };
File without changes
@@ -0,0 +1,151 @@
1
+ import { jsx, jsxs } from "react/jsx-runtime";
2
+ import styled from "@emotion/styled";
3
+ import { createContext, useContext } from "react";
4
+ import { Tab, TabList, TabPanel, Tabs } from "react-aria-components";
5
+ import { marginProps, maxWidthHeightProps, paddingProps, widthHeightProps } from "./helpers/styledProps.js";
6
+ import Icon from "./Icon/index.js";
7
+ const TabsContext = /*#__PURE__*/ createContext({
8
+ detached: false,
9
+ panelPosition: 'bottom'
10
+ });
11
+ const TabsListContext = /*#__PURE__*/ createContext({});
12
+ const Tabs_Tabs = ({ children, detached = false, panelPosition = 'bottom', disabled = false, ...props })=>/*#__PURE__*/ jsx(TabsContext.Provider, {
13
+ value: {
14
+ detached,
15
+ panelPosition
16
+ },
17
+ children: /*#__PURE__*/ jsx(Container, {
18
+ orientation: "horizontal",
19
+ isDisabled: disabled,
20
+ panelPosition: panelPosition,
21
+ ...props,
22
+ children: children
23
+ })
24
+ });
25
+ const List = ({ tabWidth = 'fill', borderRadius, padding, paddingTop, paddingBottom, paddingRight, paddingLeft, ...props })=>/*#__PURE__*/ jsx(TabsListContext.Provider, {
26
+ value: {
27
+ borderRadius,
28
+ padding,
29
+ paddingTop,
30
+ paddingBottom,
31
+ paddingRight,
32
+ paddingLeft
33
+ },
34
+ children: /*#__PURE__*/ jsx(ListContainer, {
35
+ ...props,
36
+ tabWidth: tabWidth
37
+ })
38
+ });
39
+ List.displayName = 'Tabs.List';
40
+ const Item = ({ children, icon, iconColor, iconPosition = 'left', disabled, ...props })=>{
41
+ const { detached, panelPosition } = useContext(TabsContext);
42
+ const styleProps = useContext(TabsListContext);
43
+ return /*#__PURE__*/ jsxs(TabItem, {
44
+ ...props,
45
+ detached: detached,
46
+ isDisabled: disabled,
47
+ reverse: 'right' === iconPosition,
48
+ panelPosition: panelPosition,
49
+ ...styleProps,
50
+ children: [
51
+ icon && /*#__PURE__*/ jsx(Icon, {
52
+ name: icon,
53
+ size: "small",
54
+ color: iconColor
55
+ }),
56
+ children
57
+ ]
58
+ });
59
+ };
60
+ Item.displayName = 'Tabs.Item';
61
+ const Panel = (props)=>{
62
+ const { detached, panelPosition } = useContext(TabsContext);
63
+ return /*#__PURE__*/ jsx(PanelContainer, {
64
+ ...props,
65
+ detached: detached,
66
+ panelPosition: panelPosition
67
+ });
68
+ };
69
+ Panel.displayName = 'Tabs.Panel';
70
+ const Container = styled(Tabs)(marginProps, widthHeightProps, maxWidthHeightProps, ({ height, maxHeight, panelPosition })=>({
71
+ display: 'grid',
72
+ gridTemplateRows: 'top' === panelPosition ? '1fr auto' : 'auto 1fr',
73
+ '& > [role="tablist"]': {
74
+ order: 'top' === panelPosition ? 2 : 1
75
+ },
76
+ '& > [role="tabpanel"]': {
77
+ order: 'top' === panelPosition ? 1 : 2
78
+ },
79
+ overflow: height || maxHeight ? 'hidden' : void 0
80
+ }));
81
+ const ListContainer = styled(TabList)(({ tabWidth })=>({
82
+ display: 'flex',
83
+ '& > *': {
84
+ flex: 'fill' === tabWidth ? 1 : 'initial'
85
+ }
86
+ }));
87
+ const TabItem = styled(Tab)(({ theme, detached, reverse, gap = 8, panelPosition, borderRadius })=>{
88
+ const radius = borderRadius ?? 4;
89
+ return {
90
+ display: 'flex',
91
+ flexDirection: reverse ? 'row-reverse' : 'row',
92
+ justifyContent: 'center',
93
+ alignItems: 'center',
94
+ gap,
95
+ backgroundColor: 'transparent',
96
+ padding: '8px 16px',
97
+ border: '1px solid',
98
+ borderColor: theme.scale0,
99
+ borderRadius: 0,
100
+ color: theme.scale6,
101
+ fontSize: theme.font.size.md,
102
+ fontWeight: theme.font.weight.medium,
103
+ cursor: 'pointer',
104
+ transition: 'all 0.2s linear',
105
+ '&:first-of-type': {
106
+ borderTopLeftRadius: 'bottom' === panelPosition ? radius : 0,
107
+ borderBottomLeftRadius: 'top' === panelPosition || detached ? radius : 0
108
+ },
109
+ '&:last-of-type': {
110
+ borderTopRightRadius: 'bottom' === panelPosition ? radius : 0,
111
+ borderBottomRightRadius: 'top' === panelPosition || detached ? radius : 0
112
+ },
113
+ '&[data-selected]': {
114
+ backgroundColor: theme.scale0,
115
+ color: theme.scale10,
116
+ borderColor: 'transparent'
117
+ },
118
+ '&:not([data-selected])[data-hovered]': {
119
+ backgroundColor: theme.scale1,
120
+ borderColor: 'transparent'
121
+ },
122
+ '&[data-disabled]': {
123
+ opacity: 0.5,
124
+ cursor: 'not-allowed'
125
+ },
126
+ '&[data-focused]': {
127
+ outline: 'none'
128
+ },
129
+ '&[data-focus-visible]': {
130
+ borderColor: theme.accent
131
+ }
132
+ };
133
+ }, paddingProps);
134
+ const PanelContainer = styled(TabPanel)(({ theme, detached, panelPosition })=>({
135
+ padding: detached ? void 0 : 16,
136
+ backgroundColor: detached ? void 0 : theme.scale0,
137
+ borderBottomLeftRadius: detached || 'top' === panelPosition ? void 0 : 4,
138
+ borderBottomRightRadius: detached || 'top' === panelPosition ? void 0 : 4,
139
+ borderTopLeftRadius: 'top' === panelPosition ? 4 : 0,
140
+ borderTopRightRadius: 'top' === panelPosition ? 4 : 0,
141
+ overflow: 'auto',
142
+ minHeight: 0,
143
+ '&[data-focused]': {
144
+ outline: 'none'
145
+ }
146
+ }));
147
+ Tabs_Tabs.List = List;
148
+ Tabs_Tabs.Item = Item;
149
+ Tabs_Tabs.Panel = Panel;
150
+ const components_Tabs = Tabs_Tabs;
151
+ export { Item, List, Panel, components_Tabs as default };
@@ -0,0 +1,71 @@
1
+ import { jsx, jsxs } from "react/jsx-runtime";
2
+ import { useTheme } from "@emotion/react";
3
+ import styled from "@emotion/styled";
4
+ import getIcon from "./helpers/getIcon.js";
5
+ import { marginProps, paddingProps } from "./helpers/styledProps.js";
6
+ import Icon from "./Icon/index.js";
7
+ import Tooltip from "./Tooltip.js";
8
+ const Tag = ({ children, id, value, iconLeft, iconRight, tooltip, removable, disabled, size = 'small', onRemove, ...props })=>{
9
+ const { scale10 } = useTheme();
10
+ const handleRemove = (key)=>{
11
+ if (onRemove) onRemove(key);
12
+ };
13
+ const content = children || value;
14
+ return /*#__PURE__*/ jsxs(Item, {
15
+ id: id,
16
+ disabled: disabled,
17
+ rightIcon: !!(iconRight || removable && !disabled),
18
+ removable: removable,
19
+ size: size,
20
+ ...props,
21
+ children: [
22
+ iconLeft && getIcon(iconLeft, {
23
+ marginRight: 4,
24
+ size: 'small'
25
+ }),
26
+ tooltip ? /*#__PURE__*/ jsx(Tooltip, {
27
+ trigger: content,
28
+ zIndex: 100,
29
+ ...tooltip
30
+ }) : content,
31
+ removable && !disabled && /*#__PURE__*/ jsx(Icon, {
32
+ name: "close-circle",
33
+ size: "small",
34
+ marginLeft: 4,
35
+ pointer: true,
36
+ onClick: !disabled && id ? ()=>handleRemove(id) : void 0,
37
+ color: disabled ? void 0 : scale10
38
+ }),
39
+ iconRight && getIcon(iconRight, {
40
+ marginLeft: 4,
41
+ size: 'small'
42
+ })
43
+ ]
44
+ });
45
+ };
46
+ const Item = styled.div(({ theme, disabled, invalid, rightIcon, type, removable, size })=>{
47
+ const tag = theme.tag[type || 'default'];
48
+ return {
49
+ display: 'flex',
50
+ alignItems: 'center',
51
+ width: 'max-content',
52
+ color: disabled || invalid ? theme.scale4 : theme.scale10,
53
+ cursor: 'default',
54
+ fontSize: theme.font.size.sm,
55
+ fontWeight: theme.font.weight.medium,
56
+ fontFamily: theme.font.family.default,
57
+ borderRadius: 40,
58
+ padding: `${'small' === size ? 2 : 4}px ${theme.size.sm}px`,
59
+ paddingRight: rightIcon ? theme.size.xs : void 0,
60
+ backgroundColor: disabled || invalid ? tag.backgroundDisabled : tag.background,
61
+ '&:hover': {
62
+ backgroundColor: disabled || invalid || !removable ? void 0 : tag.backgroundHover
63
+ },
64
+ '&:focus-visible': {
65
+ outline: `${theme.accent} solid 1px`,
66
+ outlineOffset: -1
67
+ }
68
+ };
69
+ }, marginProps, paddingProps);
70
+ const components_Tag = Tag;
71
+ export { components_Tag as default };
@@ -0,0 +1,59 @@
1
+ import { jsx, jsxs } from "react/jsx-runtime";
2
+ import { useEffect, useState } from "react";
3
+ import ToggleOff from "../assets/icons/ToggleOff.js";
4
+ import ToggleOn from "../assets/icons/ToggleOn.js";
5
+ import { ControlContainer, ControlInput, ControlLabel } from "./FormControl.js";
6
+ import Icon from "./Icon/index.js";
7
+ const Toggle = ({ id, label, labelPosition, checked, disabled, onChange, margin, marginTop, marginBottom, marginRight, marginLeft, ...props })=>{
8
+ const [on, setOn] = useState(checked || false);
9
+ const labelRight = 'right' === labelPosition;
10
+ const marginProps = {
11
+ margin,
12
+ marginTop,
13
+ marginBottom,
14
+ marginRight,
15
+ marginLeft
16
+ };
17
+ const handleChange = ()=>{
18
+ const value = !on;
19
+ setOn(value);
20
+ onChange(value);
21
+ };
22
+ useEffect(()=>{
23
+ const checkedSet = 'boolean' == typeof checked;
24
+ const value = checkedSet ? checked : on;
25
+ setOn(value);
26
+ }, [
27
+ checked,
28
+ on
29
+ ]);
30
+ return /*#__PURE__*/ jsxs(ControlContainer, {
31
+ htmlFor: id,
32
+ labelRight: labelRight,
33
+ disabled: disabled,
34
+ ...marginProps,
35
+ children: [
36
+ label && /*#__PURE__*/ jsx(ControlLabel, {
37
+ children: label
38
+ }),
39
+ /*#__PURE__*/ jsx(ControlInput, {
40
+ id: id,
41
+ type: "checkbox",
42
+ checked: on,
43
+ disabled: disabled,
44
+ onChange: handleChange,
45
+ ...props
46
+ }),
47
+ /*#__PURE__*/ jsx(Icon, {
48
+ svg: on ? /*#__PURE__*/ jsx(ToggleOn, {}) : /*#__PURE__*/ jsx(ToggleOff, {}),
49
+ marginLeft: label && !labelRight ? 8 : 0,
50
+ marginRight: label && labelRight ? 8 : 0,
51
+ pointer: !disabled,
52
+ width: 34,
53
+ height: 17
54
+ })
55
+ ]
56
+ });
57
+ };
58
+ const components_Toggle = Toggle;
59
+ export { components_Toggle as default };
@@ -0,0 +1,104 @@
1
+ import { jsxs } from "react/jsx-runtime";
2
+ import { useTheme } from "@emotion/react";
3
+ import styled from "@emotion/styled";
4
+ import { useContext } from "react";
5
+ import { ToggleButton } from "react-aria-components";
6
+ import getIcon from "../helpers/getIcon.js";
7
+ import { marginProps, paddingProps } from "../helpers/styledProps.js";
8
+ import { ToggleContext } from "./context.js";
9
+ const ToggleButton_ToggleButton_ToggleButton = ({ children, disabled, size, positive, negative, caution, secondary, iconLeft, iconRight, borderRadius, ...props })=>{
10
+ const { type, joined, size: toggleSize, height } = useContext(ToggleContext);
11
+ const { button } = useTheme();
12
+ const { iconSize } = button[size || toggleSize];
13
+ const positiveStyle = positive || 'positive' === type;
14
+ const negativeStyle = negative || 'negative' === type;
15
+ const cautionStyle = caution || 'caution' === type;
16
+ const secondaryStyle = secondary || 'secondary' === type;
17
+ return /*#__PURE__*/ jsxs(Button, {
18
+ isDisabled: disabled || 'disabled' === type,
19
+ positive: positiveStyle,
20
+ negative: negativeStyle,
21
+ caution: cautionStyle,
22
+ secondary: secondaryStyle,
23
+ borderRadius: borderRadius,
24
+ joined: joined,
25
+ size: size || toggleSize,
26
+ height: height,
27
+ ...props,
28
+ children: [
29
+ iconLeft && getIcon(iconLeft, {
30
+ size: iconSize
31
+ }),
32
+ children,
33
+ iconRight && getIcon(iconRight, {
34
+ size: iconSize
35
+ })
36
+ ]
37
+ });
38
+ };
39
+ const Button = styled(ToggleButton)(({ theme, secondary, negative, positive, caution, isDisabled, joined, borderRadius, size, height })=>{
40
+ let buttonType = 'primary';
41
+ if (secondary) buttonType = 'secondary';
42
+ if (negative) buttonType = 'negative';
43
+ if (positive) buttonType = 'positive';
44
+ if (caution) buttonType = 'caution';
45
+ if (isDisabled) buttonType = 'disabled';
46
+ const sizeStyle = theme.button[size || 'small'];
47
+ const style = theme.button[buttonType];
48
+ const background = style.outlineBackground.default;
49
+ const backgroundHover = style.outlineBackground.hover;
50
+ const backgroundActive = style.outlineBackground.active;
51
+ const borderColor = style.border.default;
52
+ const color = style.outlineColor.default;
53
+ const colorHover = style.outlineColor.hover;
54
+ const colorActive = style.outlineColor.active;
55
+ const buttonHeight = height || sizeStyle.height;
56
+ return {
57
+ display: 'inline-flex',
58
+ alignItems: 'center',
59
+ justifyContent: 'center',
60
+ gap: 4,
61
+ height: joined ? buttonHeight : height || '100%',
62
+ border: `1px solid ${borderColor}`,
63
+ background,
64
+ color,
65
+ padding: joined ? `0px ${sizeStyle.padding}px` : sizeStyle.padding,
66
+ borderRadius: borderRadius || 8,
67
+ cursor: 'pointer',
68
+ fontSize: sizeStyle.font,
69
+ fontFamily: theme.font.family.default,
70
+ fontWeight: theme.font.weight.bold,
71
+ '&[data-hovered]': {
72
+ background: backgroundHover,
73
+ color: colorHover
74
+ },
75
+ '&[data-pressed], &[data-selected]': {
76
+ background: backgroundActive,
77
+ color: colorActive
78
+ },
79
+ '&[data-focus-visible]': {
80
+ outline: `${theme.accent} solid 1px`
81
+ },
82
+ '&[data-disabled]': {
83
+ cursor: 'not-allowed',
84
+ background: theme.button.disabled.outlineBackground.default,
85
+ borderColor: theme.button.disabled.border.default,
86
+ color: theme.button.disabled.outlineColor.default
87
+ },
88
+ ...joined ? {
89
+ borderRadius: borderRadius || 30,
90
+ '&:not(:first-of-type)': {
91
+ borderTopLeftRadius: 0,
92
+ borderBottomLeftRadius: 0,
93
+ borderLeft: 'none'
94
+ },
95
+ '&:not(:last-of-type)': {
96
+ borderTopRightRadius: 0,
97
+ borderBottomRightRadius: 0,
98
+ borderRight: `1px solid ${borderColor}`
99
+ }
100
+ } : {}
101
+ };
102
+ }, marginProps, paddingProps);
103
+ const ToggleButton_ToggleButton = ToggleButton_ToggleButton_ToggleButton;
104
+ export { ToggleButton_ToggleButton as default };
@@ -0,0 +1,36 @@
1
+ import { jsx } from "react/jsx-runtime";
2
+ import styled from "@emotion/styled";
3
+ import { ToggleButtonGroup } from "react-aria-components";
4
+ import { marginProps, paddingProps } from "../helpers/styledProps.js";
5
+ import { ToggleContext } from "./context.js";
6
+ const ToggleButtonGroup_ToggleButtonGroup = ({ disabled, secondary, negative, positive, caution, joined, gap, size = 'small', height, ...props })=>{
7
+ let buttonType = 'primary';
8
+ if (secondary) buttonType = 'secondary';
9
+ if (negative) buttonType = 'negative';
10
+ if (positive) buttonType = 'positive';
11
+ if (caution) buttonType = 'caution';
12
+ if (disabled) buttonType = 'disabled';
13
+ return /*#__PURE__*/ jsx(ToggleContext.Provider, {
14
+ value: {
15
+ type: buttonType,
16
+ joined,
17
+ size,
18
+ height
19
+ },
20
+ children: /*#__PURE__*/ jsx(ButtonGroup, {
21
+ ...props,
22
+ isDisabled: disabled,
23
+ gap: joined ? 0 : gap
24
+ })
25
+ });
26
+ };
27
+ const ButtonGroup = styled(ToggleButtonGroup)(({ gap = 8, width })=>({
28
+ display: 'grid',
29
+ gridAutoFlow: 'column',
30
+ gridAutoColumns: '1fr',
31
+ alignItems: 'center',
32
+ gap,
33
+ width
34
+ }), marginProps, paddingProps);
35
+ const ToggleButton_ToggleButtonGroup = ToggleButtonGroup_ToggleButtonGroup;
36
+ export { ToggleButton_ToggleButtonGroup as default };
@@ -0,0 +1,8 @@
1
+ import { createContext } from "react";
2
+ const ToggleContext = createContext({
3
+ type: 'primary',
4
+ joined: false,
5
+ size: 'small',
6
+ height: void 0
7
+ });
8
+ export { ToggleContext };
@@ -0,0 +1,3 @@
1
+ import ToggleButton from "./ToggleButton.js";
2
+ import ToggleButtonGroup from "./ToggleButtonGroup.js";
3
+ export { ToggleButton, ToggleButtonGroup };