@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,162 @@
1
+ import { jsx, jsxs } from "react/jsx-runtime";
2
+ import styled from "@emotion/styled";
3
+ import { useState } from "react";
4
+ import { Button, FieldError, Select, SelectValue } from "react-aria-components";
5
+ import { useControlledOpenState } from "../hooks/index.js";
6
+ import getIcon from "./helpers/getIcon.js";
7
+ import { paddingProps as styledProps_js_paddingProps } from "./helpers/styledProps.js";
8
+ import Icon from "./Icon/index.js";
9
+ import InputContainerStyles from "./Inputs/helpers/InputContainerStyles.js";
10
+ import InputMessage from "./Inputs/helpers/InputMessage.js";
11
+ import Label from "./Inputs/helpers/Label.js";
12
+ import ListBoxItem from "./ListBoxParts/ListBoxItem.js";
13
+ import ListOptions from "./ListBoxParts/ListOptions.js";
14
+ import ListRootStyles, { preventProps } from "./ListHelpers/ListRootStyles.js";
15
+ import ListSection from "./ListHelpers/ListSection.js";
16
+ import MotionPopover from "./MotionPopover.js";
17
+ import Spinner from "./Spinner.js";
18
+ const Select_Select = ({ backgroundColor, menuBackground, children, fontSize, fontWeight, color, disabled, invalid, required, readOnly, loading, label, options, placeholder = 'Select', placeholderColor, description, errorMessage, textOnly, value, defaultValue, width, height, maxHeight, allowRepeatSelection, hideCaret, position, fixedPosition, borderRadius, iconLeft, leftElement, rightElement, before, after, open, onOpenChange, onChange, afterShow, afterHide, ref, ...props })=>{
19
+ const [isOpen, handleOpenChange] = useControlledOpenState({
20
+ open,
21
+ onOpenChange,
22
+ afterShow,
23
+ afterHide
24
+ });
25
+ const [internalValue, setInternalValue] = useState(defaultValue || '');
26
+ const isControlled = void 0 !== value;
27
+ const currentValue = isControlled ? value : internalValue;
28
+ const { padding, paddingTop, paddingBottom, paddingRight, paddingLeft } = props;
29
+ const { margin, marginTop, marginBottom, marginRight, marginLeft } = props;
30
+ const paddingProps = {
31
+ padding,
32
+ paddingTop,
33
+ paddingBottom,
34
+ paddingRight,
35
+ paddingLeft
36
+ };
37
+ const marginProps = {
38
+ margin,
39
+ marginTop,
40
+ marginBottom,
41
+ marginRight,
42
+ marginLeft
43
+ };
44
+ const handleSelect = (val)=>{
45
+ if (!val) return;
46
+ if (!allowRepeatSelection && val === currentValue) return;
47
+ if (!isControlled) setInternalValue(val);
48
+ if (onChange) onChange(val);
49
+ };
50
+ const hasValue = !!(currentValue || defaultValue);
51
+ const hidePlaceholder = !hasValue && label;
52
+ const caret = hideCaret ? null : /*#__PURE__*/ jsx(Icon, {
53
+ name: isOpen ? 'caret-up' : 'caret-down',
54
+ color: color
55
+ });
56
+ return /*#__PURE__*/ jsxs(SelectRoot, {
57
+ placeholder: placeholder,
58
+ isOpen: isOpen,
59
+ onOpenChange: handleOpenChange,
60
+ onChange: handleSelect,
61
+ isDisabled: disabled || readOnly || loading,
62
+ isInvalid: invalid,
63
+ isRequired: required,
64
+ value: currentValue,
65
+ defaultValue: defaultValue,
66
+ textOnly: textOnly,
67
+ width: width,
68
+ selectionMode: "single",
69
+ ...props,
70
+ children: [
71
+ /*#__PURE__*/ jsxs(SelectContainer, {
72
+ backgroundColor: backgroundColor,
73
+ textOnly: textOnly,
74
+ hasLabel: !!label,
75
+ isDisabled: disabled,
76
+ isReadOnly: readOnly || loading,
77
+ isInvalid: invalid,
78
+ borderRadius: borderRadius,
79
+ height: height,
80
+ pointer: true,
81
+ ref: ref,
82
+ iconLeft: !!iconLeft,
83
+ ...paddingProps,
84
+ ...marginProps,
85
+ children: [
86
+ iconLeft && getIcon(iconLeft, {
87
+ marginRight: 8
88
+ }),
89
+ leftElement,
90
+ /*#__PURE__*/ jsx(Label, {
91
+ label: label,
92
+ filled: hasValue,
93
+ disabled: disabled,
94
+ disablePointerEvents: true,
95
+ children: /*#__PURE__*/ jsx(DisplayValue, {
96
+ fontSize: fontSize,
97
+ fontWeight: fontWeight,
98
+ color: color,
99
+ placeholderColor: placeholderColor,
100
+ isDisabled: disabled,
101
+ style: ({ isPlaceholder })=>isPlaceholder && hidePlaceholder ? {
102
+ opacity: 0,
103
+ position: 'absolute'
104
+ } : {},
105
+ children: ({ isPlaceholder, selectedText, defaultChildren })=>isPlaceholder ? defaultChildren : selectedText
106
+ })
107
+ }),
108
+ rightElement,
109
+ loading ? /*#__PURE__*/ jsx(Spinner, {
110
+ size: "small"
111
+ }) : caret,
112
+ /*#__PURE__*/ jsx(InputMessage, {
113
+ description: description,
114
+ errorMessage: errorMessage
115
+ })
116
+ ]
117
+ }),
118
+ /*#__PURE__*/ jsx(FieldError, {}),
119
+ /*#__PURE__*/ jsx(MotionPopover, {
120
+ offset: 2,
121
+ placement: position,
122
+ shouldFlip: fixedPosition ? false : void 0,
123
+ maxHeight: maxHeight,
124
+ children: ({ isEntering, isExiting })=>/*#__PURE__*/ jsx(ListOptions, {
125
+ options: options,
126
+ autoWidth: textOnly,
127
+ readOnly: isEntering || isExiting,
128
+ before: before,
129
+ after: after,
130
+ menuBackground: menuBackground,
131
+ children: children
132
+ })
133
+ })
134
+ ]
135
+ });
136
+ };
137
+ const Item = ListBoxItem;
138
+ const Section = ListSection;
139
+ const SelectRoot = styled(Select, preventProps)(ListRootStyles);
140
+ const SelectContainer = styled(Button)(InputContainerStyles, ({ iconLeft, textOnly })=>({
141
+ paddingLeft: iconLeft ? 8 : void 0,
142
+ paddingRight: textOnly ? void 0 : 8
143
+ }), styledProps_js_paddingProps);
144
+ const DisplayValue = styled(SelectValue)(({ theme: { input, font }, fontSize, fontWeight, color, placeholderColor, isDisabled })=>({
145
+ color: color || (isDisabled ? input.color.disabled : input.color.default),
146
+ fontFamily: font.family.default,
147
+ fontSize: fontSize || font.size.lg,
148
+ fontWeight: fontWeight || font.weight.default,
149
+ width: '100%',
150
+ textAlign: 'start',
151
+ overflow: 'hidden',
152
+ textOverflow: 'ellipsis',
153
+ whiteSpace: 'nowrap',
154
+ '&[data-placeholder]': {
155
+ color: placeholderColor || (isDisabled ? input.color.disabled : input.color.placeholder)
156
+ }
157
+ }));
158
+ const components_Select = Object.assign(Select_Select, {
159
+ Item,
160
+ Section
161
+ });
162
+ export { components_Select as default };
@@ -0,0 +1,50 @@
1
+ import { jsx } from "react/jsx-runtime";
2
+ import styled from "@emotion/styled";
3
+ import { marginProps } from "./helpers/styledProps.js";
4
+ const Slider_Slider = ({ value, max = 100, step = 1, width, height, disabled, onChange, ...props })=>{
5
+ const handleControlGrab = (event)=>{
6
+ const { value: progressValue } = event.target;
7
+ if (onChange) onChange(+progressValue);
8
+ };
9
+ return /*#__PURE__*/ jsx(ProgressSlider, {
10
+ ...props,
11
+ type: "range",
12
+ max: max,
13
+ value: value,
14
+ percent: value / max * 100,
15
+ onChange: handleControlGrab,
16
+ step: step,
17
+ width: width,
18
+ height: height,
19
+ disabled: disabled,
20
+ readOnly: !onChange
21
+ });
22
+ };
23
+ const thumbControlStyles = (theme, disabled)=>({
24
+ appearance: 'none',
25
+ backgroundColor: disabled ? 'transparent' : theme.color.brand,
26
+ height: theme.size.sm,
27
+ width: theme.size.sm,
28
+ border: 'none',
29
+ borderRadius: '50%'
30
+ });
31
+ const ProgressSlider = styled.input(({ theme, percent, width, height, disabled, readOnly })=>{
32
+ const trackColor = disabled ? theme.scale0 : theme.scale1;
33
+ const progressColor = disabled ? theme.scale1 : theme.color.brand;
34
+ return {
35
+ appearance: 'none',
36
+ display: 'block',
37
+ width: width || '100%',
38
+ height: height || 2,
39
+ borderRadius: 24,
40
+ outline: 'none',
41
+ background: `linear-gradient(to right, ${progressColor} 0%, ${progressColor} ${percent}%, ${trackColor} ${percent}%, ${trackColor} 100%)`,
42
+ '&::-webkit-slider-thumb': thumbControlStyles(theme, disabled || readOnly),
43
+ '&::-moz-range-thumb': thumbControlStyles(theme, disabled || readOnly),
44
+ '&:focus-visible': {
45
+ outline: disabled || readOnly ? 'none' : `${theme.accent} solid 1px`
46
+ }
47
+ };
48
+ }, marginProps);
49
+ const Slider = Slider_Slider;
50
+ export { Slider as default };
@@ -0,0 +1,70 @@
1
+ import { jsx } from "react/jsx-runtime";
2
+ import { keyframes } from "@emotion/react";
3
+ import styled from "@emotion/styled";
4
+ import { marginProps, positionProps } from "./helpers/styledProps.js";
5
+ import Icon from "./Icon/Icon.js";
6
+ const Spinner = ({ size, color, center, background, zIndex, margin, marginTop, marginBottom, marginRight, marginLeft, position, top, bottom, right, left, className, ...props })=>{
7
+ const rest = {
8
+ margin,
9
+ marginTop,
10
+ marginBottom,
11
+ marginRight,
12
+ marginLeft,
13
+ position,
14
+ top,
15
+ bottom,
16
+ right,
17
+ left,
18
+ className
19
+ };
20
+ return /*#__PURE__*/ jsx(SpinContainer, {
21
+ ...rest,
22
+ center: center,
23
+ background: background,
24
+ zIndex: zIndex,
25
+ children: /*#__PURE__*/ jsx(Spin, {
26
+ children: /*#__PURE__*/ jsx(Icon, {
27
+ ...props,
28
+ size: size,
29
+ name: "loading",
30
+ color: color
31
+ })
32
+ })
33
+ });
34
+ };
35
+ const SpinContainer = styled.div({
36
+ width: 'max-content',
37
+ height: 'max-content'
38
+ }, ({ center, zIndex })=>center && {
39
+ position: 'absolute',
40
+ top: '50%',
41
+ left: '50%',
42
+ transform: 'translate(-50%, -50%)',
43
+ zIndex: zIndex ?? 1
44
+ }, ({ center, background })=>{
45
+ if (!center || !background) return null;
46
+ const backgroundColor = 'string' == typeof background ? background : 'rgba(0, 0, 0, 0.5)';
47
+ return {
48
+ background: backgroundColor,
49
+ width: '100%',
50
+ height: '100%',
51
+ display: 'flex',
52
+ justifyContent: 'center',
53
+ alignItems: 'center'
54
+ };
55
+ }, marginProps, positionProps);
56
+ const spin = keyframes({
57
+ '0%': {
58
+ transform: 'rotate(0deg)'
59
+ },
60
+ '100%': {
61
+ transform: 'rotate(360deg)'
62
+ }
63
+ });
64
+ const Spin = styled.div({
65
+ animation: `${spin} 1s linear infinite`,
66
+ width: 'max-content',
67
+ height: 'max-content'
68
+ });
69
+ const components_Spinner = Spinner;
70
+ export { components_Spinner as default };
@@ -0,0 +1,49 @@
1
+ import { jsx, jsxs } from "react/jsx-runtime";
2
+ import styled from "@emotion/styled";
3
+ import { TableBody, TableLoadMoreItem } from "react-aria-components";
4
+ import Spinner from "../Spinner.js";
5
+ const Body_Body = ({ children, emptyFallback, fetching, loading, scrollOffset, onLoadMore, ...rest })=>{
6
+ const emptyContent = loading ? /*#__PURE__*/ jsx(SpinnerContainer, {
7
+ children: /*#__PURE__*/ jsx(Spinner, {})
8
+ }) : emptyFallback;
9
+ return /*#__PURE__*/ jsxs(BodyEl, {
10
+ renderEmptyState: ({ isEmpty })=>isEmpty && emptyContent ? emptyContent : null,
11
+ loading: loading,
12
+ ...rest,
13
+ children: [
14
+ !loading && children,
15
+ /*#__PURE__*/ jsx(LoadingRow, {
16
+ isLoading: fetching,
17
+ onLoadMore: onLoadMore,
18
+ scrollOffset: scrollOffset,
19
+ children: /*#__PURE__*/ jsx(SpinnerContainer, {
20
+ children: /*#__PURE__*/ jsx(Spinner, {
21
+ size: "small"
22
+ })
23
+ })
24
+ })
25
+ ]
26
+ });
27
+ };
28
+ const BodyEl = styled(TableBody)(({ theme, loading })=>({
29
+ '&[data-empty]': {
30
+ textAlign: 'center',
31
+ color: theme.table.color.body,
32
+ fontSize: theme.font.size.sm,
33
+ '& > tr:last-of-type > td:first-of-type': {
34
+ paddingTop: loading ? void 0 : 16
35
+ }
36
+ }
37
+ }));
38
+ const LoadingRow = styled(TableLoadMoreItem)(({ theme })=>({
39
+ borderTop: `1px solid ${theme.table.borderColor}`
40
+ }));
41
+ const SpinnerContainer = styled.div(({ theme })=>({
42
+ display: 'flex',
43
+ justifyContent: 'center',
44
+ alignItems: 'center',
45
+ color: theme.scale6,
46
+ paddingTop: 4
47
+ }));
48
+ const Body = Body_Body;
49
+ export { Body as default };
@@ -0,0 +1,63 @@
1
+ import { jsx } from "react/jsx-runtime";
2
+ import styled from "@emotion/styled";
3
+ import { useContext } from "react";
4
+ import { Cell } from "react-aria-components";
5
+ import Ellipsis from "../Ellipsis.js";
6
+ import contentStyles from "./contentStyles.js";
7
+ import context from "./context.js";
8
+ const Cell_Cell = ({ children, defaultValue, direction, justify, align, gap, clampLines, ...props })=>{
9
+ const { rowPadding } = useContext(context);
10
+ const contentProps = {
11
+ direction,
12
+ justify,
13
+ align,
14
+ gap
15
+ };
16
+ const content = children ?? defaultValue;
17
+ return /*#__PURE__*/ jsx(TableCell, {
18
+ parentPadding: rowPadding,
19
+ ...props,
20
+ children: /*#__PURE__*/ jsx(Content, {
21
+ showDefault: !!defaultValue && null == children,
22
+ ...contentProps,
23
+ children: 'string' == typeof content ? /*#__PURE__*/ jsx(Ellipsis, {
24
+ paddingRight: 2,
25
+ clampLines: clampLines,
26
+ children: content
27
+ }) : content
28
+ })
29
+ });
30
+ };
31
+ const TableCell = styled(Cell)(({ theme })=>({
32
+ padding: 0,
33
+ outline: 'none',
34
+ outlineOffset: -1,
35
+ '&:focus-visible': {
36
+ outline: `${theme.accent} solid 1px`
37
+ }
38
+ }), ({ padding, paddingTop, paddingBottom, paddingRight, paddingLeft, parentPadding })=>{
39
+ const { top, right, bottom, left } = parentPadding || {};
40
+ const leftVal = void 0 !== left ? left - 2 : void 0;
41
+ return {
42
+ '& > div': {
43
+ paddingTop: paddingTop ?? top ?? 16,
44
+ paddingBottom: paddingBottom ?? bottom ?? 16,
45
+ paddingLeft,
46
+ paddingRight,
47
+ padding
48
+ },
49
+ '&:first-of-type > div': {
50
+ paddingLeft: paddingLeft ?? leftVal ?? 24
51
+ },
52
+ '&:last-of-type > div': {
53
+ paddingRight: paddingRight ?? right ?? 24
54
+ }
55
+ };
56
+ });
57
+ const Content = styled.div(contentStyles, ({ showDefault })=>showDefault && {
58
+ '& > *': {
59
+ opacity: 0.3
60
+ }
61
+ });
62
+ const Table_Cell = Cell_Cell;
63
+ export { Table_Cell as default };
@@ -0,0 +1,35 @@
1
+ import { jsx } from "react/jsx-runtime";
2
+ import styled from "@emotion/styled";
3
+ import { Checkbox } from "react-aria-components";
4
+ import icons_Checkbox from "../../assets/icons/Checkbox.js";
5
+ import CheckboxOff from "../../assets/icons/CheckboxOff.js";
6
+ import CheckboxPartial from "../../assets/icons/CheckboxPartial.js";
7
+ import Icon from "../Icon/index.js";
8
+ const Check = ({ ...props })=>/*#__PURE__*/ jsx(CheckContainer, {
9
+ ...props,
10
+ children: ({ isIndeterminate, isSelected, isDisabled })=>{
11
+ let svg = /*#__PURE__*/ jsx(CheckboxOff, {});
12
+ if (isIndeterminate) svg = /*#__PURE__*/ jsx(CheckboxPartial, {});
13
+ else if (isSelected) svg = /*#__PURE__*/ jsx(icons_Checkbox, {});
14
+ return /*#__PURE__*/ jsx(Icon, {
15
+ svg: svg,
16
+ pointer: !isDisabled
17
+ });
18
+ }
19
+ });
20
+ const CheckContainer = styled(Checkbox)(({ theme: { formControl }, isDisabled })=>({
21
+ '&[data-hovered] > div': {
22
+ color: isDisabled ? void 0 : formControl.color.hover
23
+ },
24
+ '&[data-selected] > div, &[data-indeterminate] > div': {
25
+ color: formControl.color.active
26
+ },
27
+ '&[data-hovered][data-selected] > div': {
28
+ color: isDisabled ? void 0 : formControl.color.activeHover
29
+ },
30
+ '&[data-disabled] > div': {
31
+ color: formControl.color.disabled
32
+ }
33
+ }));
34
+ const Table_Check = Check;
35
+ export { Table_Check as default };
@@ -0,0 +1,129 @@
1
+ import { jsx, jsxs } from "react/jsx-runtime";
2
+ import styled from "@emotion/styled";
3
+ import { useContext, useEffect, useState } from "react";
4
+ import { Column } from "react-aria-components";
5
+ import Ellipsis from "../Ellipsis.js";
6
+ import Icon from "../Icon/index.js";
7
+ import ColumnSort from "./ColumnSort.js";
8
+ import contentStyles from "./contentStyles.js";
9
+ import context from "./context.js";
10
+ import Resizer from "./Resizer.js";
11
+ const Column_Column = ({ children, sortKey, sorted, onClick, resize, direction, justify, align, gap, ...props })=>{
12
+ const [sortDirection, setSortDirection] = useState(sorted || 'inactive');
13
+ const { activeColumn, setActiveColumn, headerPadding } = useContext(context);
14
+ const sortEnabled = sortKey || sorted;
15
+ const active = 'asc' === sortDirection || 'desc' === sortDirection;
16
+ const contentProps = {
17
+ direction,
18
+ justify,
19
+ align,
20
+ gap
21
+ };
22
+ const sort = (dir)=>{
23
+ setSortDirection(dir);
24
+ if (setActiveColumn && sortKey) {
25
+ const column = 'inactive' === dir ? void 0 : {
26
+ key: sortKey,
27
+ dir
28
+ };
29
+ setActiveColumn(column);
30
+ }
31
+ };
32
+ const handleCellClick = (event)=>{
33
+ if (sortKey) if ('inactive' === sortDirection) sort('asc');
34
+ else 'asc' === sortDirection ? sort('desc') : sort('inactive');
35
+ else if (onClick) onClick(event);
36
+ };
37
+ useEffect(()=>{
38
+ if (sortKey && ('asc' === sorted || 'desc' === sorted)) sort(sorted);
39
+ }, []);
40
+ useEffect(()=>{
41
+ if (sorted) setSortDirection(sorted);
42
+ }, [
43
+ sorted
44
+ ]);
45
+ useEffect(()=>{
46
+ const initialSetup = !activeColumn && sorted;
47
+ const activeColumnChanged = sortKey && activeColumn && activeColumn.key !== sortKey;
48
+ const sortSet = 'inactive' !== sortDirection;
49
+ if (activeColumnChanged && sortSet && !initialSetup) setSortDirection('inactive');
50
+ }, [
51
+ activeColumn,
52
+ sortDirection
53
+ ]);
54
+ const clickFn = sortEnabled || onClick ? handleCellClick : void 0;
55
+ const handleKeyDown = (e)=>{
56
+ if ('Enter' === e.key || ' ' === e.key) clickFn?.(e);
57
+ };
58
+ return /*#__PURE__*/ jsx(HeaderColumn, {
59
+ parentPadding: headerPadding,
60
+ ...props,
61
+ children: /*#__PURE__*/ jsxs(Content, {
62
+ sorting: !!sortEnabled,
63
+ active: active,
64
+ ...contentProps,
65
+ children: [
66
+ 'string' == typeof children ? /*#__PURE__*/ jsx(Ellipsis, {
67
+ onClick: clickFn,
68
+ children: children
69
+ }) : children,
70
+ sortEnabled && /*#__PURE__*/ jsx("span", {
71
+ onClick: clickFn,
72
+ onKeyDown: handleKeyDown,
73
+ children: /*#__PURE__*/ jsx(Icon, {
74
+ svg: /*#__PURE__*/ jsx(ColumnSort, {
75
+ sortDirection: sortDirection
76
+ }),
77
+ marginLeft: -8,
78
+ style: {
79
+ borderRadius: 4
80
+ }
81
+ })
82
+ }),
83
+ resize && /*#__PURE__*/ jsx(Resizer, {})
84
+ ]
85
+ })
86
+ });
87
+ };
88
+ const HeaderColumn = styled(Column)(({ theme, width, maxWidth, minWidth })=>({
89
+ textAlign: 'left',
90
+ verticalAlign: 'middle',
91
+ color: theme.table.color.header,
92
+ fontSize: theme.font.size.sm,
93
+ fontWeight: theme.font.weight.medium,
94
+ padding: 0,
95
+ outline: 'none',
96
+ outlineOffset: -1,
97
+ width: width || void 0,
98
+ maxWidth: maxWidth || void 0,
99
+ minWidth: minWidth || void 0,
100
+ '&:focus-visible': {
101
+ outline: `${theme.accent} solid 1px`
102
+ }
103
+ }), ({ theme, padding, paddingTop, paddingBottom, paddingRight, paddingLeft, parentPadding })=>({
104
+ '& > div': {
105
+ paddingTop: paddingTop ?? parentPadding?.top ?? 8,
106
+ paddingBottom: paddingBottom ?? parentPadding?.bottom ?? 8,
107
+ paddingLeft,
108
+ paddingRight,
109
+ padding,
110
+ borderBottom: `1px solid ${theme.table.borderColor}`
111
+ },
112
+ '&:first-of-type > div': {
113
+ paddingLeft: paddingLeft ?? parentPadding?.left ?? 24
114
+ },
115
+ '&:last-of-type > div': {
116
+ paddingRight: paddingRight ?? parentPadding?.right ?? 24
117
+ }
118
+ }));
119
+ const Content = styled.div(contentStyles, ({ theme, sorting, active })=>({
120
+ '& > div:first-of-type, & > span': {
121
+ cursor: sorting ? 'pointer' : void 0,
122
+ color: active ? theme.scale10 : theme.table.color.header,
123
+ '&:hover': {
124
+ color: sorting ? theme.scale8 : void 0
125
+ }
126
+ }
127
+ }));
128
+ const Table_Column = Column_Column;
129
+ export { Table_Column as default };
@@ -0,0 +1,26 @@
1
+ import { jsx, jsxs } from "react/jsx-runtime";
2
+ import { useTheme } from "@emotion/react";
3
+ const ColumnSort_ColumnSort = ({ sortDirection })=>{
4
+ const { accent, scale4 } = useTheme();
5
+ const topColor = 'asc' === sortDirection ? accent : scale4;
6
+ const bottomColor = 'desc' === sortDirection ? accent : 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: "M11.3739 3.29206C11.7639 2.90239 12.3941 2.90226 12.7841 3.29206L17.3739 7.88288C17.7636 8.2728 17.7635 8.90211 17.3739 9.29206C16.9839 9.68206 16.3537 9.68206 15.9637 9.29206L12.0839 5.41218L8.20398 9.29206C7.81398 9.68206 7.18382 9.68206 6.79382 9.29206C6.40405 8.90205 6.40416 8.26281 6.78406 7.88288L11.3739 3.29206Z",
14
+ fill: topColor,
15
+ transform: "scale(0.8) translate(3, 3)"
16
+ }),
17
+ /*#__PURE__*/ jsx("path", {
18
+ d: "M15.9725 13.878C16.3625 13.488 16.9927 13.488 17.3827 13.878C17.7723 14.2679 17.7723 14.8973 17.3827 15.2872L12.7928 19.878C12.4029 20.2678 11.7727 20.2677 11.3827 19.878L6.79285 15.2872C6.40288 14.8972 6.40292 14.268 6.79285 13.878C7.17285 13.498 7.813 13.488 8.203 13.878L12.0829 17.7579L15.9725 13.878Z",
19
+ fill: bottomColor,
20
+ transform: "scale(0.8) translate(3, 3)"
21
+ })
22
+ ]
23
+ });
24
+ };
25
+ const ColumnSort = ColumnSort_ColumnSort;
26
+ export { ColumnSort as default };
@@ -0,0 +1,64 @@
1
+ import { Fragment, jsx, jsxs } from "react/jsx-runtime";
2
+ import styled from "@emotion/styled";
3
+ import { useContext, useEffect } from "react";
4
+ import { TableHeader } from "react-aria-components";
5
+ import mergePadding from "../helpers/mergePadding.js";
6
+ import Check from "./Check.js";
7
+ import Column from "./Column.js";
8
+ import context from "./context.js";
9
+ const Header_Header = ({ children, backgroundColor, padding, paddingTop, paddingRight, paddingBottom, paddingLeft, ...rest })=>{
10
+ const { setHeaderPadding, selectionMode } = useContext(context);
11
+ useEffect(()=>{
12
+ const values = padding ?? paddingTop ?? paddingRight ?? paddingBottom ?? paddingLeft;
13
+ if (null != values && setHeaderPadding) {
14
+ const paddingValues = mergePadding({
15
+ padding,
16
+ paddingTop,
17
+ paddingRight,
18
+ paddingBottom,
19
+ paddingLeft
20
+ });
21
+ setHeaderPadding(paddingValues);
22
+ }
23
+ }, [
24
+ padding,
25
+ paddingTop,
26
+ paddingRight,
27
+ paddingBottom,
28
+ paddingLeft,
29
+ setHeaderPadding
30
+ ]);
31
+ const columnsToRender = selectionMode ? /*#__PURE__*/ jsxs(Fragment, {
32
+ children: [
33
+ /*#__PURE__*/ jsx(Column, {
34
+ width: 70,
35
+ children: 'multiple' === selectionMode && /*#__PURE__*/ jsx(Check, {
36
+ slot: "selection"
37
+ })
38
+ }),
39
+ children
40
+ ]
41
+ }) : children;
42
+ return /*#__PURE__*/ jsx(TableHead, {
43
+ backgroundColor: backgroundColor,
44
+ ...rest,
45
+ children: columnsToRender
46
+ });
47
+ };
48
+ const TableHead = styled(TableHeader)(({ backgroundColor })=>({
49
+ position: 'sticky',
50
+ top: 0,
51
+ zIndex: 1,
52
+ backgroundColor: 'inherit',
53
+ '& > tr': {
54
+ height: '100%'
55
+ },
56
+ '& > tr > th': {
57
+ backgroundColor: backgroundColor || 'inherit'
58
+ },
59
+ '& > tr > th:first-of-type > div': {
60
+ borderLeft: '2px solid transparent'
61
+ }
62
+ }));
63
+ const Header = Header_Header;
64
+ export { Header as default };
@@ -0,0 +1,25 @@
1
+ import styled from "@emotion/styled";
2
+ import { ColumnResizer } from "react-aria-components";
3
+ const Resizer_Resizer = styled(ColumnResizer)(({ theme })=>({
4
+ width: 9,
5
+ height: 18,
6
+ backgroundColor: theme.scale4,
7
+ marginLeft: 'auto',
8
+ backgroundClip: 'content-box',
9
+ border: '4px transparent',
10
+ borderStyle: 'none solid',
11
+ '&[data-resizable-direction=both]': {
12
+ cursor: 'col-resize'
13
+ },
14
+ '&[data-resizable-direction=left]': {
15
+ cursor: 'e-resize'
16
+ },
17
+ '&[data-resizable-direction=right]': {
18
+ cursor: 'w-resize'
19
+ },
20
+ '&[data-focus-visible]': {
21
+ backgroundColor: theme.accent
22
+ }
23
+ }));
24
+ const Resizer = Resizer_Resizer;
25
+ export { Resizer as default };