@vuu-ui/vuu-ui-controls 2.1.19-beta.1 → 2.1.19-beta.2

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 (180) hide show
  1. package/package.json +12 -13
  2. package/src/calendar/Calendar.css.js +10 -0
  3. package/src/calendar/Calendar.js +70 -0
  4. package/src/calendar/index.js +4 -0
  5. package/src/calendar/internal/CalendarCarousel.css.js +19 -0
  6. package/src/calendar/internal/CalendarCarousel.js +73 -0
  7. package/src/calendar/internal/CalendarContext.js +9 -0
  8. package/src/calendar/internal/CalendarDay.css.js +116 -0
  9. package/src/calendar/internal/CalendarDay.js +64 -0
  10. package/src/calendar/internal/CalendarMonth.css.js +13 -0
  11. package/src/calendar/internal/CalendarMonth.js +43 -0
  12. package/src/calendar/internal/CalendarNavigation.css.js +24 -0
  13. package/src/calendar/internal/CalendarNavigation.js +185 -0
  14. package/src/calendar/internal/CalendarWeekHeader.css.js +23 -0
  15. package/src/calendar/internal/CalendarWeekHeader.js +31 -0
  16. package/src/calendar/internal/useFocusManagement.js +66 -0
  17. package/src/calendar/internal/utils.js +57 -0
  18. package/src/calendar/useCalendar.js +116 -0
  19. package/src/calendar/useCalendarDay.js +74 -0
  20. package/src/calendar/useSelection.js +202 -0
  21. package/src/column-picker/ColumnPicker.css.js +8 -0
  22. package/src/column-picker/ColumnPicker.js +108 -0
  23. package/src/column-picker/ColumnSearch.css.js +61 -0
  24. package/src/column-picker/ColumnSearch.js +66 -0
  25. package/src/column-picker/index.js +2 -0
  26. package/src/column-picker/moving-window.js +49 -0
  27. package/src/common-hooks/index.js +3 -0
  28. package/src/common-hooks/selectionTypes.js +8 -0
  29. package/src/common-hooks/use-resize-observer.js +122 -0
  30. package/src/common-hooks/useControlled.js +45 -0
  31. package/src/context-panel-provider/ContextPanelProvider.js +80 -0
  32. package/src/cycle-state-button/CycleStateButton.js +30 -0
  33. package/src/cycle-state-button/index.js +1 -0
  34. package/src/date-input/DateInput.css.js +195 -0
  35. package/src/date-input/DateInput.js +210 -0
  36. package/src/date-input/index.js +1 -0
  37. package/src/date-picker/DatePicker.js +137 -0
  38. package/src/date-picker/DatePickerContext.js +20 -0
  39. package/src/date-picker/DatePickerPanel.css.js +25 -0
  40. package/src/date-picker/DatePickerPanel.js +124 -0
  41. package/src/date-picker/index.js +1 -0
  42. package/src/drag-drop/DragDropProvider.js +123 -0
  43. package/src/drag-drop/DragDropState.js +25 -0
  44. package/src/drag-drop/Draggable.css.js +57 -0
  45. package/src/drag-drop/Draggable.js +77 -0
  46. package/src/drag-drop/DropIndicator.css.js +11 -0
  47. package/src/drag-drop/DropIndicator.js +28 -0
  48. package/src/drag-drop/dragDropTypes.js +3 -0
  49. package/src/drag-drop/drop-target-utils.js +199 -0
  50. package/src/drag-drop/index.js +6 -0
  51. package/src/drag-drop/useAutoScroll.js +53 -0
  52. package/src/drag-drop/useDragDisplacers.js +126 -0
  53. package/src/drag-drop/useDragDrop.js +435 -0
  54. package/src/drag-drop/useDragDropCopy.js +22 -0
  55. package/src/drag-drop/useDragDropIndicator.js +182 -0
  56. package/src/drag-drop/useDragDropNaturalMovement.js +205 -0
  57. package/src/drag-drop/useDropIndicator.js +21 -0
  58. package/src/drag-drop/useGlobalDragDrop.js +67 -0
  59. package/src/drag-drop/useTransition.js +11 -0
  60. package/src/editable/index.js +1 -0
  61. package/src/editable/useEditableText.js +199 -0
  62. package/src/editable-label/EditableLabel.css.js +81 -0
  63. package/src/editable-label/EditableLabel.js +125 -0
  64. package/src/editable-label/index.js +1 -0
  65. package/src/expando-input/ExpandoInput.css.js +67 -0
  66. package/src/expando-input/ExpandoInput.js +40 -0
  67. package/src/expando-input/index.js +1 -0
  68. package/src/highlighter/Highlighter.css.js +8 -0
  69. package/src/highlighter/Highlighter.js +27 -0
  70. package/src/highlighter/index.js +1 -0
  71. package/src/hover-overlay/HoverOverlay.js +92 -0
  72. package/src/icon-button/Icon.css.js +8 -0
  73. package/src/icon-button/Icon.js +26 -0
  74. package/src/icon-button/IconButton.css.js +10 -0
  75. package/src/icon-button/IconButton.js +28 -0
  76. package/src/icon-button/ToggleIconButton.css.js +47 -0
  77. package/src/icon-button/ToggleIconButton.js +26 -0
  78. package/src/icon-button/index.js +3 -0
  79. package/src/index.js +31 -0
  80. package/src/instrument-picker/SearchCell.css.js +17 -0
  81. package/src/instrument-picker/SearchCell.js +29 -0
  82. package/src/instrument-picker/TablePicker.css.js +23 -0
  83. package/src/instrument-picker/TablePicker.js +89 -0
  84. package/src/instrument-picker/index.js +1 -0
  85. package/src/instrument-picker/moving-window.js +49 -0
  86. package/src/instrument-picker/useDataSource.js +38 -0
  87. package/src/instrument-picker/useTablePicker.js +136 -0
  88. package/src/measured-container/MeasuredContainer.css.js +11 -0
  89. package/src/measured-container/MeasuredContainer.js +50 -0
  90. package/src/measured-container/index.js +2 -0
  91. package/src/measured-container/useMeasuredContainer.js +156 -0
  92. package/src/modal-provider/ModalProvider.js +147 -0
  93. package/src/overflow-container/OverflowContainer.css.js +135 -0
  94. package/src/overflow-container/OverflowContainer.js +87 -0
  95. package/src/overflow-container/index.js +2 -0
  96. package/src/overflow-container/overflow-utils.js +211 -0
  97. package/src/overflow-container/useOverflowContainer.js +108 -0
  98. package/src/price-ticker/PriceTicker.css.js +32 -0
  99. package/src/price-ticker/PriceTicker.js +51 -0
  100. package/src/price-ticker/index.js +1 -0
  101. package/src/prompt/Prompt.css.js +48 -0
  102. package/src/prompt/Prompt.js +112 -0
  103. package/src/sortable-list/SortableList.js +39 -0
  104. package/src/split-button/SplitButton.css.js +117 -0
  105. package/src/split-button/SplitButton.js +60 -0
  106. package/src/split-button/SplitStateButton.css.js +66 -0
  107. package/src/split-button/SplitStateButton.js +23 -0
  108. package/src/split-button/index.js +2 -0
  109. package/src/split-button/useSplitButton.js +61 -0
  110. package/src/table-search/SearchCell.css.js +20 -0
  111. package/src/table-search/SearchCell.js +26 -0
  112. package/src/table-search/TableSearch.css.js +27 -0
  113. package/src/table-search/TableSearch.js +81 -0
  114. package/src/table-search/index.js +1 -0
  115. package/src/table-search/moving-window.js +49 -0
  116. package/src/table-search/useTableSearch.js +30 -0
  117. package/src/tabs-next/TabBar.css.js +26 -0
  118. package/src/tabs-next/TabBar.js +27 -0
  119. package/src/tabs-next/TabListNext.css.js +36 -0
  120. package/src/tabs-next/TabListNext.js +94 -0
  121. package/src/tabs-next/TabNext.css.js +76 -0
  122. package/src/tabs-next/TabNext.js +91 -0
  123. package/src/tabs-next/TabNextAction.js +26 -0
  124. package/src/tabs-next/TabNextContext.js +14 -0
  125. package/src/tabs-next/TabNextPanel.css.js +17 -0
  126. package/src/tabs-next/TabNextPanel.js +69 -0
  127. package/src/tabs-next/TabNextTrigger.css.js +22 -0
  128. package/src/tabs-next/TabNextTrigger.js +66 -0
  129. package/src/tabs-next/TabOverflowList.css.js +77 -0
  130. package/src/tabs-next/TabOverflowList.js +115 -0
  131. package/src/tabs-next/TabsNext.js +149 -0
  132. package/src/tabs-next/TabsNextContext.js +28 -0
  133. package/src/tabs-next/hooks/useCollection.js +80 -0
  134. package/src/tabs-next/hooks/useFocusOutside.js +23 -0
  135. package/src/tabs-next/hooks/useOverflow.js +118 -0
  136. package/src/tabs-next/index.js +7 -0
  137. package/src/tabstrip/Tab.css.js +148 -0
  138. package/src/tabstrip/Tab.js +107 -0
  139. package/src/tabstrip/TabMenu.css.js +8 -0
  140. package/src/tabstrip/TabMenu.js +48 -0
  141. package/src/tabstrip/TabMenuOptions.js +14 -0
  142. package/src/tabstrip/TabsTypes.js +0 -0
  143. package/src/tabstrip/Tabstrip.css.js +121 -0
  144. package/src/tabstrip/Tabstrip.js +106 -0
  145. package/src/tabstrip/ThemeTabstrip.css.js +20 -0
  146. package/src/tabstrip/index.js +4 -0
  147. package/src/tabstrip/tabstrip-dom-utils.js +11 -0
  148. package/src/tabstrip/useAnimatedSelectionThumb.js +68 -0
  149. package/src/tabstrip/useKeyboardNavigation.js +191 -0
  150. package/src/tabstrip/useSelection.js +50 -0
  151. package/src/tabstrip/useTabstrip.js +181 -0
  152. package/src/time-input/MaskedInput.js +285 -0
  153. package/src/time-input/TimeInput.css.js +39 -0
  154. package/src/time-input/TimeInput.js +37 -0
  155. package/src/time-input/useTimeInput.js +82 -0
  156. package/src/toolbar/Toolbar.css.js +46 -0
  157. package/src/toolbar/Toolbar.js +62 -0
  158. package/src/toolbar/index.js +1 -0
  159. package/src/toolbar/toolbar-dom-utils.js +11 -0
  160. package/src/toolbar/useKeyboardNavigation.js +240 -0
  161. package/src/toolbar/useSelection.js +82 -0
  162. package/src/toolbar/useToolbar.js +73 -0
  163. package/src/utils/deprecated-types.js +0 -0
  164. package/src/utils/escapeRegExp.js +5 -0
  165. package/src/utils/forwardCallbackProps.js +15 -0
  166. package/src/utils/index.js +5 -0
  167. package/src/utils/isOverflowElement.js +2 -0
  168. package/src/utils/isPlainObject.js +2 -0
  169. package/src/vuu-date-picker/VuuDatePicker.js +92 -0
  170. package/src/vuu-date-picker/index.js +1 -0
  171. package/src/vuu-input/VuuInput.css.js +13 -0
  172. package/src/vuu-input/VuuInput.js +85 -0
  173. package/src/vuu-input/index.js +1 -0
  174. package/src/vuu-time-picker/TimeRangePicker.js +0 -0
  175. package/src/vuu-time-picker/VuuTimePicker.css.js +14 -0
  176. package/src/vuu-time-picker/VuuTimePicker.js +26 -0
  177. package/src/vuu-typeahead-input/VuuTypeaheadInput.css.js +49 -0
  178. package/src/vuu-typeahead-input/VuuTypeaheadInput.js +46 -0
  179. package/src/vuu-typeahead-input/index.js +1 -0
  180. package/src/vuu-typeahead-input/useVuuTypeaheadInput.js +140 -0
@@ -0,0 +1,199 @@
1
+ import { DataValidationError, dispatchCustomEvent, getTypedValue, isRpcError, isRpcSuccess } from "@vuu-ui/vuu-utils";
2
+ import { useCallback, useMemo, useRef, useState } from "react";
3
+ const stringValueOf = (value)=>value?.toString() ?? "";
4
+ const useEditableText = ({ column, value, onEdit, type = "string" })=>{
5
+ const [editState, setEditState] = useState({
6
+ editing: false,
7
+ value: stringValueOf(value)
8
+ });
9
+ const initialValueRef = useRef(value?.toString() ?? "");
10
+ const isDirtyRef = useRef(false);
11
+ useMemo(()=>{
12
+ if (initialValueRef.current !== value?.toString()) {
13
+ initialValueRef.current = stringValueOf(value);
14
+ setEditState((editState)=>({
15
+ ...editState,
16
+ message: void 0,
17
+ value: stringValueOf(value)
18
+ }));
19
+ }
20
+ }, [
21
+ value
22
+ ]);
23
+ const commit = useCallback(async ()=>{
24
+ const { value } = editState;
25
+ const result = column.clientSideEditValidationCheck?.(value, "*");
26
+ if (result?.ok === false) setEditState((state)=>({
27
+ ...state,
28
+ message: result?.messages?.join(",")
29
+ }));
30
+ else {
31
+ const { current: initialValue } = initialValueRef;
32
+ const previousValue = getTypedValue(initialValue, type);
33
+ try {
34
+ const typedValue = getTypedValue(value, type, true);
35
+ const response = await onEdit?.({
36
+ editType: "commit",
37
+ isValid: true,
38
+ previousValue,
39
+ value: typedValue
40
+ }, "commit");
41
+ if (isRpcSuccess(response)) {
42
+ isDirtyRef.current = false;
43
+ setEditState(({ previousValue, value })=>({
44
+ editing: false,
45
+ previousValue: previousValue === value ? void 0 : void 0 === previousValue ? initialValue : previousValue,
46
+ value
47
+ }));
48
+ } else if (isRpcError(response)) {
49
+ setEditState((state)=>({
50
+ ...state,
51
+ message: response.errorMessage
52
+ }));
53
+ return false;
54
+ }
55
+ initialValueRef.current = value;
56
+ return true;
57
+ } catch (e) {
58
+ if (e instanceof DataValidationError) {
59
+ const { actualType, expectedType, message } = e;
60
+ if (column) {
61
+ const { name, label = name } = column;
62
+ const message = `${label} is a ${expectedType} value, data entered is ${actualType} `;
63
+ setEditState((state)=>({
64
+ ...state,
65
+ message
66
+ }));
67
+ onEdit?.({
68
+ editType: "commit",
69
+ isValid: false,
70
+ previousValue,
71
+ value
72
+ }, "commit");
73
+ } else setEditState((state)=>({
74
+ ...state,
75
+ message
76
+ }));
77
+ }
78
+ }
79
+ }
80
+ return false;
81
+ }, [
82
+ column,
83
+ editState,
84
+ onEdit,
85
+ type
86
+ ]);
87
+ const toggleActivation = useCallback(async (input, cancel = false)=>{
88
+ if (editState.editing) if (isDirtyRef.current) if (cancel) {
89
+ const { value: previousValue } = editState;
90
+ isDirtyRef.current = false;
91
+ setEditState({
92
+ editing: false,
93
+ value: initialValueRef.current,
94
+ message: void 0
95
+ });
96
+ onEdit?.({
97
+ editType: "cancel",
98
+ isValid: true,
99
+ previousValue,
100
+ value: initialValueRef.current
101
+ }, "commit");
102
+ } else {
103
+ const commitSuccessful = await commit();
104
+ if (commitSuccessful) {
105
+ setEditState((editState)=>({
106
+ ...editState,
107
+ editing: false
108
+ }));
109
+ dispatchCustomEvent(input, "vuu-commit");
110
+ }
111
+ }
112
+ else setEditState((editState)=>({
113
+ ...editState,
114
+ editing: false
115
+ }));
116
+ else if (!cancel) {
117
+ setEditState((editState)=>({
118
+ ...editState,
119
+ editing: true
120
+ }));
121
+ input.select();
122
+ }
123
+ }, [
124
+ commit,
125
+ editState,
126
+ onEdit
127
+ ]);
128
+ const handleKeyDown = useCallback(async (evt)=>{
129
+ const { key, target } = evt;
130
+ const input = target;
131
+ if ("Enter" === key) toggleActivation(input);
132
+ else if ("ArrowRight" === key || "ArrowLeft" === key || "ArrowUp" === key || "ArrowDown" === key) {
133
+ if (editState.editing) evt.stopPropagation();
134
+ } else if ("Escape" === evt.key) toggleActivation(input, true);
135
+ }, [
136
+ editState,
137
+ toggleActivation
138
+ ]);
139
+ const handleFocus = useCallback((e)=>{
140
+ const input = e.target;
141
+ const source = e.relatedTarget;
142
+ if (source?.classList.contains("vuuTableCell") && source.contains(input)) toggleActivation(input);
143
+ }, [
144
+ toggleActivation
145
+ ]);
146
+ const handleBlur = useCallback(async ()=>{
147
+ if (editState.editing) {
148
+ if (isDirtyRef.current) {
149
+ const commitSuccessful = await commit();
150
+ console.log({
151
+ commitSuccessful
152
+ });
153
+ }
154
+ setEditState((editState)=>({
155
+ ...editState,
156
+ editing: false
157
+ }));
158
+ }
159
+ }, [
160
+ commit,
161
+ editState
162
+ ]);
163
+ const handleChange = useCallback((evt)=>{
164
+ const { value } = evt.target;
165
+ isDirtyRef.current = value !== initialValueRef.current;
166
+ const result = column.clientSideEditValidationCheck?.(value, "change");
167
+ setEditState({
168
+ editing: true,
169
+ value
170
+ });
171
+ onEdit?.({
172
+ editType: "change",
173
+ isValid: result?.ok !== false,
174
+ previousValue: initialValueRef.current,
175
+ value
176
+ }, "change");
177
+ if (result?.ok === false) setEditState({
178
+ editing: true,
179
+ value,
180
+ message: result.messages?.join(",")
181
+ });
182
+ }, [
183
+ column,
184
+ onEdit
185
+ ]);
186
+ return {
187
+ editing: editState.editing,
188
+ inputProps: {
189
+ onBlur: handleBlur,
190
+ onFocus: handleFocus,
191
+ onKeyDown: handleKeyDown
192
+ },
193
+ onChange: handleChange,
194
+ previousValue: editState.previousValue,
195
+ value: editState.value,
196
+ warningMessage: editState.message
197
+ };
198
+ };
199
+ export { useEditableText };
@@ -0,0 +1,81 @@
1
+ const css = `
2
+ .vuuEditableLabel {
3
+ --editableLabel-padding: var(--vuuEditableLabel-padding, 6px);
4
+ --editableLabel-height: var(--vuuEditableLabel-height, 26px);
5
+ --saltInput-background: transparent;
6
+ --saltInput-height: calc(var(--editableLabel-height) - 4px);
7
+ --saltInput-minWidth: 14px;
8
+ color: inherit;
9
+ cursor: default;
10
+ font-size: var(--salt-text-fontSize);
11
+ letter-spacing: normal;
12
+ height: 100%;
13
+ padding-right: var(--editableLabel-padding);
14
+ text-overflow: ellipsis;
15
+ white-space: nowrap;
16
+ z-index: var(--salt-zIndex-default);
17
+ flex-direction: column;
18
+ justify-content: center;
19
+ display: inline-flex;
20
+ position: relative;
21
+ overflow: hidden;
22
+
23
+ &[data-embedded] {
24
+ outline: none;
25
+ }
26
+
27
+ & .saltInput-activationIndicator {
28
+ display: none;
29
+ }
30
+
31
+ & .saltInput-focused {
32
+ background-color: inherit;
33
+ outline: none;
34
+ }
35
+ }
36
+
37
+ .vuuEditableLabel:before {
38
+ box-sizing: content-box;
39
+ content: attr(data-text);
40
+ height: 0;
41
+ padding: 0 var(--salt-spacing-200);
42
+ visibility: hidden;
43
+ white-space: pre-wrap;
44
+ display: block;
45
+ }
46
+
47
+ .vuuEditableLabel .saltInput {
48
+ font-weight: var(--salt-text-fontWeight);
49
+ left: var(--editableLabel-padding, 0);
50
+ padding: 0 var(--salt-spacing-100);
51
+ right: var(--editableLabel-padding, 0);
52
+ top: var(--saltEditableLabel-top, 1px);
53
+ width: calc(100% - 4px);
54
+ }
55
+
56
+ .vuuEditableLabel-input {
57
+ box-sizing: content-box;
58
+ color: inherit;
59
+ font: inherit;
60
+ background-color: #0000;
61
+ border: none;
62
+ outline: none;
63
+ flex: 1;
64
+ width: 0;
65
+ min-width: 0;
66
+ height: 20px;
67
+ margin: 0;
68
+ padding: 0;
69
+ display: block;
70
+ }
71
+
72
+ .vuuEditableLabel-label {
73
+ text-overflow: ellipsis;
74
+ white-space: nowrap;
75
+ padding-left: 10px;
76
+ overflow: hidden;
77
+ }
78
+
79
+
80
+ `;
81
+ export default css;
@@ -0,0 +1,125 @@
1
+ import { jsx } from "react/jsx-runtime";
2
+ import clsx from "clsx";
3
+ import { forwardRef, useCallback, useImperativeHandle, useLayoutEffect, useRef } from "react";
4
+ import { Input, useControlled } from "@salt-ds/core";
5
+ import { useComponentCssInjection } from "@salt-ds/styles";
6
+ import { useWindow } from "@salt-ds/window";
7
+ import EditableLabel_0 from "./EditableLabel.css";
8
+ const classBase = "vuuEditableLabel";
9
+ const NullEditAPI = {
10
+ beginEdit: ()=>void 0
11
+ };
12
+ const EditableLabel_EditableLabel = /*#__PURE__*/ forwardRef(function({ className: classNameProp, defaultEditing, defaultValue, editLabelApiRef, editing: editingProp, onChange, onEnterEditMode, onExitEditMode, value: valueProp, ...restProps }, forwardedRef) {
13
+ const targetWindow = useWindow();
14
+ useComponentCssInjection({
15
+ testId: "vuu-editable-label",
16
+ css: EditableLabel_0,
17
+ window: targetWindow
18
+ });
19
+ const inputRef = useRef(null);
20
+ const editingRef = useRef(false);
21
+ const [value, setValue] = useControlled({
22
+ controlled: valueProp,
23
+ default: defaultValue ?? "",
24
+ name: "EditableLabel",
25
+ state: "value"
26
+ });
27
+ const [editing, _setEditing] = useControlled({
28
+ controlled: editingProp,
29
+ default: defaultEditing ?? false,
30
+ name: "EditableLabel",
31
+ state: "editing"
32
+ });
33
+ const setEditing = useCallback((value)=>{
34
+ _setEditing(editingRef.current = value);
35
+ }, [
36
+ _setEditing
37
+ ]);
38
+ const initialValue = useRef(value);
39
+ useLayoutEffect(()=>{
40
+ if (editing) {
41
+ if (null !== inputRef.current) {
42
+ inputRef.current.select();
43
+ inputRef.current.focus();
44
+ }
45
+ }
46
+ }, [
47
+ editing,
48
+ inputRef
49
+ ]);
50
+ const beginEdit = useCallback(()=>{
51
+ setEditing(true);
52
+ onEnterEditMode?.();
53
+ }, [
54
+ onEnterEditMode,
55
+ setEditing
56
+ ]);
57
+ useImperativeHandle(editLabelApiRef, ()=>({
58
+ beginEdit
59
+ }), [
60
+ beginEdit
61
+ ]);
62
+ const exitEditMode = useCallback(({ cancelEdit = false, allowDeactivation = false } = {})=>{
63
+ setEditing(false);
64
+ const originalValue = initialValue.current;
65
+ if (cancelEdit || originalValue === value) {
66
+ if (originalValue !== value) setValue(originalValue);
67
+ onExitEditMode?.(originalValue, originalValue, allowDeactivation, cancelEdit);
68
+ } else {
69
+ initialValue.current = value;
70
+ onExitEditMode?.(originalValue, value, allowDeactivation, cancelEdit);
71
+ }
72
+ }, [
73
+ onExitEditMode,
74
+ setEditing,
75
+ setValue,
76
+ value
77
+ ]);
78
+ const handleChange = (evt)=>{
79
+ const { value } = evt.target;
80
+ setValue(value);
81
+ onChange && onChange(value);
82
+ };
83
+ const handleBlur = useCallback(()=>{
84
+ if (editingRef.current) exitEditMode({
85
+ allowDeactivation: true
86
+ });
87
+ }, [
88
+ exitEditMode
89
+ ]);
90
+ const handleKeyDown = (evt)=>{
91
+ if (editing && "Enter" === evt.key) {
92
+ evt.stopPropagation();
93
+ exitEditMode();
94
+ } else if ("ArrowRight" === evt.key || "ArrowLeft" === evt.key) evt.stopPropagation();
95
+ else if ("Escape" === evt.key) exitEditMode({
96
+ cancelEdit: true
97
+ });
98
+ };
99
+ const className = clsx(classBase, classNameProp, {
100
+ [`${classBase}-editing`]: editing
101
+ });
102
+ return /*#__PURE__*/ jsx("div", {
103
+ ...restProps,
104
+ className: className,
105
+ "data-text": value,
106
+ ref: forwardedRef,
107
+ children: editing ? /*#__PURE__*/ jsx(Input, {
108
+ inputProps: {
109
+ className: `${classBase}-input`,
110
+ spellCheck: false
111
+ },
112
+ value: value,
113
+ onBlur: handleBlur,
114
+ onChange: handleChange,
115
+ onKeyDown: handleKeyDown,
116
+ inputRef: inputRef,
117
+ textAlign: "left",
118
+ variant: "secondary"
119
+ }) : /*#__PURE__*/ jsx("span", {
120
+ className: `${classBase}-label`,
121
+ children: value
122
+ })
123
+ });
124
+ });
125
+ export { EditableLabel_EditableLabel as EditableLabel, NullEditAPI };
@@ -0,0 +1 @@
1
+ export * from "./EditableLabel.js";
@@ -0,0 +1,67 @@
1
+ const css = `
2
+ .vuuExpandoInput {
3
+ --expandoInput-height: var(--vuuExpandoInput-height, 26px);
4
+ --expandoInput-padding: var(--vuuExpandoInput-padding, 6px);
5
+ --saltInput-height: calc(var(--expandoInput-height) - 2px);
6
+ --saltInput-minHeight: var(--saltInput-height);
7
+ --saltInput-minWidth: var(--vuuExpandoInput-minWidth, 8px);
8
+ border: var(--vuuExpandoInput-border, none);
9
+ border-radius: var(--vuuExpandoInput-borderRadius, 0);
10
+ color: inherit;
11
+ cursor: default;
12
+ font-size: var(--salt-text-fontSize);
13
+ height: var(--expandoInput-height);
14
+ min-width: calc(var(--saltInput-minWidth) + 2 * var(--expandoInput-padding));
15
+ padding: 0 var(--expandoInput-padding);
16
+ outline: none;
17
+ display: inline-block;
18
+ position: relative;
19
+
20
+ & .saltInput-secondary {
21
+ --saltInput-background: var(--vuuExpandoInput-background, var(--salt-container-primary-background));
22
+ }
23
+ }
24
+
25
+ .vuuExpandoInput:before {
26
+ content: attr(data-text);
27
+ visibility: hidden;
28
+ white-space: pre-wrap;
29
+ height: 0;
30
+ display: block;
31
+ }
32
+
33
+ .vuuExpandoInput-error {
34
+ border-color: var(--vuu-color-red-50);
35
+ }
36
+
37
+ .vuuExpandoInput .saltInput {
38
+ font-weight: var(--salt-text-fontWeight);
39
+ left: var(--expandoInput-padding, 0);
40
+ right: var(--expandoInput-padding, 0);
41
+ outline-style: none;
42
+ width: auto;
43
+ padding: 0;
44
+ position: absolute;
45
+ }
46
+
47
+ .vuuExpandoInput .saltInput-activationIndicator {
48
+ display: none;
49
+ }
50
+
51
+ .vuuExpandoInput-input {
52
+ box-sizing: content-box;
53
+ font: inherit;
54
+ background-color: #0000;
55
+ border: none;
56
+ outline: none;
57
+ flex: 1;
58
+ min-width: 0;
59
+ height: 20px;
60
+ margin: 0;
61
+ padding: 0;
62
+ display: block;
63
+ }
64
+
65
+
66
+ `;
67
+ export default css;
@@ -0,0 +1,40 @@
1
+ import { jsx } from "react/jsx-runtime";
2
+ import { useComponentCssInjection } from "@salt-ds/styles";
3
+ import { useWindow } from "@salt-ds/window";
4
+ import clsx from "clsx";
5
+ import { forwardRef } from "react";
6
+ import { VuuInput } from "../vuu-input/index.js";
7
+ import ExpandoInput_0 from "./ExpandoInput.css";
8
+ const classBase = "vuuExpandoInput";
9
+ const noop = ()=>void 0;
10
+ const ExpandoInput_ExpandoInput = /*#__PURE__*/ forwardRef(function({ className: classNameProp, errorMessage, value, inputProps, onCommit = noop, ...props }, forwardedRef) {
11
+ const targetWindow = useWindow();
12
+ useComponentCssInjection({
13
+ testId: "vuu-expando-input",
14
+ css: ExpandoInput_0,
15
+ window: targetWindow
16
+ });
17
+ return /*#__PURE__*/ jsx("div", {
18
+ className: clsx(classBase, classNameProp, {
19
+ [`${classBase}-error`]: errorMessage
20
+ }),
21
+ "data-text": value,
22
+ children: /*#__PURE__*/ jsx(VuuInput, {
23
+ ...props,
24
+ errorMessage: errorMessage,
25
+ inputProps: {
26
+ ...inputProps,
27
+ className: `${classBase}-input`
28
+ },
29
+ onCommit: onCommit,
30
+ ref: forwardedRef,
31
+ style: {
32
+ padding: 0
33
+ },
34
+ textAlign: "left",
35
+ value: value,
36
+ variant: "secondary"
37
+ })
38
+ });
39
+ });
40
+ export { ExpandoInput_ExpandoInput as ExpandoInput };
@@ -0,0 +1 @@
1
+ export * from "./ExpandoInput.js";
@@ -0,0 +1,8 @@
1
+ const css = `
2
+ .saltHighlighter-highlight {
3
+ font-weight: var(--salt-text-fontWeight-strong);
4
+ }
5
+
6
+
7
+ `;
8
+ export default css;
@@ -0,0 +1,27 @@
1
+ import { Fragment, jsx } from "react/jsx-runtime";
2
+ import { makePrefixer } from "@salt-ds/core";
3
+ import { useComponentCssInjection } from "@salt-ds/styles";
4
+ import { useWindow } from "@salt-ds/window";
5
+ import { escapeRegExp } from "../utils/index.js";
6
+ import Highlighter from "./Highlighter.css";
7
+ const withBaseName = makePrefixer("saltHighlighter");
8
+ const Highlighter_Highlighter = (props)=>{
9
+ const targetWindow = useWindow();
10
+ useComponentCssInjection({
11
+ testId: "vuu-highlighter",
12
+ css: Highlighter,
13
+ window: targetWindow
14
+ });
15
+ const { matchPattern, text = "" } = props;
16
+ const matchRegex = "string" == typeof matchPattern ? new RegExp(`(${escapeRegExp(matchPattern)})`, "gi") : matchPattern;
17
+ if (void 0 === matchRegex) return /*#__PURE__*/ jsx(Fragment, {
18
+ children: text
19
+ });
20
+ return /*#__PURE__*/ jsx("span", {
21
+ children: text.split(matchRegex).map((part, index)=>part.match(matchRegex) ? /*#__PURE__*/ jsx("strong", {
22
+ className: withBaseName("highlight"),
23
+ children: part
24
+ }, `${index}-${part}`) : part)
25
+ });
26
+ };
27
+ export { Highlighter_Highlighter as Highlighter };
@@ -0,0 +1 @@
1
+ export * from "./Highlighter.js";
@@ -0,0 +1,92 @@
1
+ import { jsx, jsxs } from "react/jsx-runtime";
2
+ import { Overlay, OverlayPanel, OverlayPanelContent, OverlayTrigger } from "@salt-ds/core";
3
+ import { useCallback, useEffect, useRef, useState } from "react";
4
+ const HoverOverlay = ({ children, open: openProp = false, onOpenChange, placement = "right", trigger })=>{
5
+ const [open, _setOpen] = useState(openProp);
6
+ const isOpen = useRef(false);
7
+ const showHandle = useRef(void 0);
8
+ const hideHandle = useRef(void 0);
9
+ const setOpen = useCallback((open)=>{
10
+ if (open !== isOpen.current) {
11
+ isOpen.current = open;
12
+ _setOpen(open);
13
+ onOpenChange?.(open);
14
+ }
15
+ }, [
16
+ onOpenChange
17
+ ]);
18
+ useEffect(()=>{
19
+ if (openProp !== isOpen.current) setOpen(openProp);
20
+ }, [
21
+ openProp,
22
+ setOpen
23
+ ]);
24
+ const handleOverlayMouseEnter = useCallback(()=>{
25
+ if (hideHandle.current) {
26
+ clearTimeout(hideHandle.current);
27
+ hideHandle.current = void 0;
28
+ }
29
+ }, []);
30
+ const handleOverlayMouseLeave = useCallback(()=>{
31
+ hideHandle.current = setTimeout(()=>{
32
+ setOpen(false);
33
+ hideHandle.current = void 0;
34
+ }, 300);
35
+ }, [
36
+ setOpen
37
+ ]);
38
+ const handleMouseEnter = useCallback(()=>{
39
+ showHandle.current = setTimeout(()=>{
40
+ setOpen(true);
41
+ showHandle.current = void 0;
42
+ }, 400);
43
+ if (hideHandle.current) {
44
+ clearTimeout(hideHandle.current);
45
+ hideHandle.current = void 0;
46
+ }
47
+ }, [
48
+ setOpen
49
+ ]);
50
+ const handleMouseLeave = useCallback(()=>{
51
+ if (showHandle.current) {
52
+ clearTimeout(showHandle.current);
53
+ showHandle.current = void 0;
54
+ } else if (isOpen.current) hideHandle.current = setTimeout(()=>{
55
+ setOpen(false);
56
+ hideHandle.current = void 0;
57
+ }, 300);
58
+ }, [
59
+ setOpen
60
+ ]);
61
+ const handleClick = useCallback(()=>{
62
+ if (showHandle.current) {
63
+ clearTimeout(showHandle.current);
64
+ showHandle.current = void 0;
65
+ } else if (isOpen.current) setOpen(false);
66
+ }, [
67
+ setOpen
68
+ ]);
69
+ return /*#__PURE__*/ jsxs(Overlay, {
70
+ placement: placement,
71
+ onOpenChange: onOpenChange,
72
+ open: open,
73
+ children: [
74
+ /*#__PURE__*/ jsx(OverlayTrigger, {
75
+ children: /*#__PURE__*/ jsx("div", {
76
+ onClick: handleClick,
77
+ onMouseEnter: handleMouseEnter,
78
+ onMouseLeave: handleMouseLeave,
79
+ children: trigger
80
+ })
81
+ }),
82
+ /*#__PURE__*/ jsx(OverlayPanel, {
83
+ children: /*#__PURE__*/ jsx(OverlayPanelContent, {
84
+ onMouseEnter: handleOverlayMouseEnter,
85
+ onMouseLeave: handleOverlayMouseLeave,
86
+ children: children
87
+ })
88
+ })
89
+ ]
90
+ });
91
+ };
92
+ export { HoverOverlay };
@@ -0,0 +1,8 @@
1
+ const css = `
2
+ .vuuIcon {
3
+ --vuu-icon-left: 0;
4
+ }
5
+
6
+
7
+ `;
8
+ export default css;
@@ -0,0 +1,26 @@
1
+ import { jsx } from "react/jsx-runtime";
2
+ import clsx from "clsx";
3
+ import { useComponentCssInjection } from "@salt-ds/styles";
4
+ import { useWindow } from "@salt-ds/window";
5
+ import Icon from "./Icon.css";
6
+ const classBase = "vuuIcon";
7
+ const Icon_Icon = ({ className, name, size, style: styleProp, ...htmlAttributes })=>{
8
+ const targetWindow = useWindow();
9
+ useComponentCssInjection({
10
+ testId: "vuu-icon",
11
+ css: Icon,
12
+ window: targetWindow
13
+ });
14
+ const style = "number" == typeof size ? {
15
+ ...styleProp,
16
+ "--vuu-icon-size": `${size}px`
17
+ } : styleProp;
18
+ return /*#__PURE__*/ jsx("span", {
19
+ ...htmlAttributes,
20
+ className: clsx(classBase, className),
21
+ "data-icon": name,
22
+ role: "img",
23
+ style: style
24
+ });
25
+ };
26
+ export { Icon_Icon as Icon };