@apple-pie/slice 0.1.3 → 0.1.4

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 (68) hide show
  1. package/README.md +47 -77
  2. package/dist/cjs/chunks/{Button-hg5kGC1P.js → Button-krf4dQeL.js} +4 -2
  3. package/dist/cjs/chunks/{FileList-BQgcnKPP.js → FileList-CkpMj-os.js} +1 -1
  4. package/dist/cjs/chunks/{ProgressIndicator-qjya_Yb5.js → ProgressIndicator-DVD-gD3T.js} +1 -1
  5. package/dist/cjs/chunks/{PromptInput-ZqHQUfXw.js → PromptInput-DULf5ock.js} +1 -1
  6. package/dist/cjs/chunks/SSEConnection-B_yE8cXz.js +140 -0
  7. package/dist/cjs/chunks/{TextArea-BhzVGfKA.js → TextArea-BJCjRUEG.js} +1 -1
  8. package/dist/cjs/chunks/{TextField-hIjxrOG9.js → TextField-CjT26H_6.js} +18 -16
  9. package/dist/cjs/chunks/{UploadArea-B4GA06LW.js → UploadArea-BE6but3t.js} +1 -1
  10. package/dist/cjs/chunks/WSConnection-DCBuJGmb.js +206 -0
  11. package/dist/cjs/chunks/{sseStore-Dg0WuXsI.js → sseStore-CIIeshjm.js} +3 -3
  12. package/dist/cjs/chunks/windowStore-CCxCOUqa.js +156 -0
  13. package/dist/cjs/components/Button/index.js +2 -2
  14. package/dist/cjs/components/FileList/index.js +2 -2
  15. package/dist/cjs/components/Progress/index.js +2 -2
  16. package/dist/cjs/components/PromptInput/index.js +4 -4
  17. package/dist/cjs/components/TextArea/index.js +3 -3
  18. package/dist/cjs/components/Textfield/index.js +3 -3
  19. package/dist/cjs/components/UploadArea/index.js +7 -8
  20. package/dist/cjs/hooks/useWindow.js +46 -11
  21. package/dist/cjs/index.js +2 -2
  22. package/dist/cjs/stores/SSE.js +2 -2
  23. package/dist/cjs/stores/WS.js +62 -0
  24. package/dist/cjs/stores/window.js +14 -3
  25. package/dist/cjs/stores.js +15 -4
  26. package/dist/cjs/utils/index.js +2 -2
  27. package/dist/cjs/utils/objects/index.js +4 -138
  28. package/dist/esm/chunks/{Button-DJDS7Yad.mjs → Button-kXFJmcKv.mjs} +4 -2
  29. package/dist/esm/chunks/{FileList-CmlXqPXl.mjs → FileList-Bon537-t.mjs} +1 -1
  30. package/dist/esm/chunks/{PromptInput-DSHVUuEf.mjs → PromptInput-DXFAZspz.mjs} +3 -3
  31. package/dist/esm/chunks/SSEConnection-Dj9P0SWE.mjs +140 -0
  32. package/dist/esm/chunks/{TextArea-CyVBzMoN.mjs → TextArea-DBmM6aQm.mjs} +1 -1
  33. package/dist/esm/chunks/{TextField-CYI2vbvO.mjs → TextField-DyUTMegV.mjs} +18 -16
  34. package/dist/esm/chunks/{UploadArea-Kez3VD4d.mjs → UploadArea-tT5V8q23.mjs} +3 -3
  35. package/dist/esm/chunks/WSConnection-DlYSitff.mjs +206 -0
  36. package/dist/esm/chunks/{sseStore-m3IPyLwJ.mjs → sseStore-DdqmnAAf.mjs} +2 -2
  37. package/dist/esm/chunks/windowStore-BOTh1g37.mjs +148 -0
  38. package/dist/esm/components/Button/index.mjs +2 -2
  39. package/dist/esm/components/FileList/index.mjs +2 -2
  40. package/dist/esm/components/Progress/index.mjs +3 -3
  41. package/dist/esm/components/PromptInput/index.mjs +4 -4
  42. package/dist/esm/components/TextArea/index.mjs +3 -3
  43. package/dist/esm/components/Textfield/index.mjs +3 -3
  44. package/dist/esm/components/UploadArea/index.mjs +7 -7
  45. package/dist/esm/hooks/useWindow.mjs +47 -11
  46. package/dist/esm/index.mjs +7 -7
  47. package/dist/esm/stores/SSE.mjs +2 -2
  48. package/dist/esm/stores/WS.mjs +59 -0
  49. package/dist/esm/stores/window.mjs +3 -1
  50. package/dist/esm/stores.mjs +5 -5
  51. package/dist/esm/utils/index.mjs +3 -1
  52. package/dist/esm/utils/objects/index.mjs +4 -139
  53. package/dist/types/hooks/index.d.ts +1 -1
  54. package/dist/types/hooks/useWindow/useWindow.d.ts +19 -0
  55. package/dist/types/index.d.ts +1 -1
  56. package/dist/types/stores/WS/_types.d.ts +17 -0
  57. package/dist/types/stores/WS/index.d.ts +2 -0
  58. package/dist/types/stores/WS/wsStore.d.ts +19 -0
  59. package/dist/types/stores/window/_types.d.ts +5 -0
  60. package/dist/types/stores/window/index.d.ts +3 -2
  61. package/dist/types/stores/window/windowStore.d.ts +8 -0
  62. package/dist/types/utils/index.d.ts +2 -2
  63. package/dist/types/utils/objects/WSConnection/WSConnection.d.ts +147 -0
  64. package/dist/types/utils/objects/index.d.ts +2 -0
  65. package/package.json +1 -1
  66. package/dist/cjs/chunks/windowStore-RaJswiHM.js +0 -70
  67. package/dist/esm/chunks/windowStore-CwW0i_le.mjs +0 -71
  68. package/dist/esm/chunks/{ProgressIndicator-h11R3FG1.mjs → ProgressIndicator-D2eairZl.mjs} +2 -2
@@ -1,8 +1,8 @@
1
1
  "use strict";
2
2
 
3
- var sseStore = require("../chunks/sseStore-Dg0WuXsI.js");
3
+ var sseStore = require("../chunks/sseStore-CIIeshjm.js");
4
4
 
5
- require("zustand"), require("../chunks/tslib.es6-C8dZW5nY.js"), require("../utils/objects/index.js"),
5
+ require("zustand"), require("../chunks/tslib.es6-C8dZW5nY.js"), require("../chunks/SSEConnection-B_yE8cXz.js"),
6
6
  exports.useConnectionClose = sseStore.useConnectionClose, exports.useConnectionMessage = sseStore.useConnectionMessage,
7
7
  exports.useIsConnected = sseStore.useIsConnected, exports.useLastSSEMessage = sseStore.useLastSSEMessage,
8
8
  exports.useMessage = sseStore.useMessage, exports.useSSE = sseStore.useSSE, exports.useSSEActions = sseStore.useSSEActions,
@@ -0,0 +1,62 @@
1
+ "use strict";
2
+
3
+ var zustand = require("zustand");
4
+
5
+ require("../chunks/tslib.es6-C8dZW5nY.js");
6
+
7
+ var WSConnection = require("../chunks/WSConnection-DCBuJGmb.js");
8
+
9
+ const useWSStore = zustand.create((set, get) => ({
10
+ connections: [],
11
+ message: null,
12
+ closedConnection: null,
13
+ actions: {
14
+ addConnection: (name, options) => {
15
+ const existingConnection = get().connections.find(c => c.name === name);
16
+ null == existingConnection || existingConnection.connection.close({
17
+ code: 1e3,
18
+ reason: "Connection replaced"
19
+ });
20
+ const userOnMessageCallback = options.onMessageCallback, connection = new WSConnection.WSConnection(Object.assign(Object.assign({}, options), {
21
+ unifiedMessages: !0,
22
+ onMessageCallback: message => {
23
+ set({
24
+ message: message
25
+ }), null == userOnMessageCallback || userOnMessageCallback(message), "close" === message.type && set({
26
+ closedConnection: name
27
+ });
28
+ }
29
+ })), nextConnection = {
30
+ name: name,
31
+ connection: connection
32
+ };
33
+ return set(state => ({
34
+ connections: [ ...state.connections.filter(connection => connection.name !== name), nextConnection ]
35
+ })), nextConnection;
36
+ },
37
+ removeConnection: name => {
38
+ const existingConnection = get().connections.find(c => c.name === name);
39
+ existingConnection && (existingConnection.connection.close({
40
+ code: 1e3,
41
+ reason: "Connection removed"
42
+ }), set(state => ({
43
+ connections: state.connections.filter(connection => connection.name !== name)
44
+ })));
45
+ }
46
+ }
47
+ }));
48
+
49
+ const useWSActions = useWSStore.getState().actions;
50
+
51
+ exports.useConnectionClose = () => useWSStore(state => state.closedConnection),
52
+ exports.useConnectionMessage = connection => useWSStore(state => state.connections.some(entry => entry.name === connection) ? state.message : null),
53
+ exports.useIsConnected = connection => useWSStore(state => {
54
+ var _a, _b;
55
+ return connection ? null !== (_b = null === (_a = state.connections.find(entry => entry.name === connection)) || void 0 === _a ? void 0 : _a.connection.connected) && void 0 !== _b && _b : state.connections.some(entry => entry.connection.connected);
56
+ }), exports.useLastWSMessage = () => useWSStore.getState().message, exports.useMessage = function(type, connection) {
57
+ return useWSStore(state => {
58
+ const sourceMessage = connection && !state.connections.some(c => c.name === connection) ? null : state.message;
59
+ return type ? (null == sourceMessage ? void 0 : sourceMessage.type) !== type ? null : "open" === type || "error" === type || "close" === type ? "event" in sourceMessage ? sourceMessage.event : null : "data" in sourceMessage ? sourceMessage.data : null : sourceMessage;
60
+ });
61
+ }, exports.useWS = () => useWSStore(state => state.actions), exports.useWSActions = useWSActions,
62
+ exports.useWSStore = useWSStore;
@@ -1,10 +1,21 @@
1
1
  "use strict";
2
2
 
3
- var windowStore = require("../chunks/windowStore-RaJswiHM.js");
3
+ var windowStore = require("../chunks/windowStore-CCxCOUqa.js");
4
4
 
5
- require("zustand"), Object.defineProperty(exports, "FormFactor", {
5
+ require("../chunks/tslib.es6-C8dZW5nY.js"), require("zustand"), Object.defineProperty(exports, "FormFactor", {
6
6
  enumerable: !0,
7
7
  get: function() {
8
8
  return windowStore.FormFactor;
9
9
  }
10
- }), exports.useWindowStore = windowStore.useWindowStore;
10
+ }), exports.dpr = windowStore.dpr, exports.formFactor = windowStore.formFactor,
11
+ exports.gettingLocation = windowStore.gettingLocation, exports.isAppleDevice = windowStore.isAppleDevice,
12
+ exports.isElectron = windowStore.isElectron, exports.isTouchDevice = windowStore.isTouchDevice,
13
+ exports.location = windowStore.location, exports.locationError = windowStore.locationError,
14
+ exports.useDpr = windowStore.useDpr, exports.useFormFactor = windowStore.useFormFactor,
15
+ exports.useGetLocation = windowStore.useGetLocation, exports.useGettingLocation = windowStore.useGettingLocation,
16
+ exports.useInitializeWindow = windowStore.useInitializeWindow, exports.useIsAppleDevice = windowStore.useIsAppleDevice,
17
+ exports.useIsElectron = windowStore.useIsElectron, exports.useIsTouchDevice = windowStore.useIsTouchDevice,
18
+ exports.useLocation = windowStore.useLocation, exports.useLocationError = windowStore.useLocationError,
19
+ exports.useViewportHeight = windowStore.useViewportHeight, exports.useViewportWidth = windowStore.useViewportWidth,
20
+ exports.useWindowStore = windowStore.useWindowStore, exports.viewportHeight = windowStore.viewportHeight,
21
+ exports.viewportWidth = windowStore.viewportWidth;
@@ -1,14 +1,25 @@
1
1
  "use strict";
2
2
 
3
- var windowStore = require("./chunks/windowStore-RaJswiHM.js"), uploadsStore = require("./chunks/uploadsStore-CxWIctvI.js"), tipStore = require("./chunks/tipStore-Ck4NLvml.js"), toastStore = require("./chunks/toastStore-CSStgB9d.js"), sseStore = require("./chunks/sseStore-Dg0WuXsI.js");
3
+ var windowStore = require("./chunks/windowStore-CCxCOUqa.js"), uploadsStore = require("./chunks/uploadsStore-CxWIctvI.js"), tipStore = require("./chunks/tipStore-Ck4NLvml.js"), toastStore = require("./chunks/toastStore-CSStgB9d.js"), sseStore = require("./chunks/sseStore-CIIeshjm.js");
4
4
 
5
- require("zustand"), require("./chunks/uploads-worker-mD8pcsGP.js"), require("./chunks/tslib.es6-C8dZW5nY.js"),
6
- require("./utils/objects/index.js"), Object.defineProperty(exports, "FormFactor", {
5
+ require("./chunks/tslib.es6-C8dZW5nY.js"), require("zustand"), require("./chunks/uploads-worker-mD8pcsGP.js"),
6
+ require("./chunks/SSEConnection-B_yE8cXz.js"), Object.defineProperty(exports, "FormFactor", {
7
7
  enumerable: !0,
8
8
  get: function() {
9
9
  return windowStore.FormFactor;
10
10
  }
11
- }), exports.useWindowStore = windowStore.useWindowStore, exports.createUploadsWorker = uploadsStore.createUploadsWorker,
11
+ }), exports.dpr = windowStore.dpr, exports.formFactor = windowStore.formFactor,
12
+ exports.gettingLocation = windowStore.gettingLocation, exports.isAppleDevice = windowStore.isAppleDevice,
13
+ exports.isElectron = windowStore.isElectron, exports.isTouchDevice = windowStore.isTouchDevice,
14
+ exports.location = windowStore.location, exports.locationError = windowStore.locationError,
15
+ exports.useDpr = windowStore.useDpr, exports.useFormFactor = windowStore.useFormFactor,
16
+ exports.useGetLocation = windowStore.useGetLocation, exports.useGettingLocation = windowStore.useGettingLocation,
17
+ exports.useInitializeWindow = windowStore.useInitializeWindow, exports.useIsAppleDevice = windowStore.useIsAppleDevice,
18
+ exports.useIsElectron = windowStore.useIsElectron, exports.useIsTouchDevice = windowStore.useIsTouchDevice,
19
+ exports.useLocation = windowStore.useLocation, exports.useLocationError = windowStore.useLocationError,
20
+ exports.useViewportHeight = windowStore.useViewportHeight, exports.useViewportWidth = windowStore.useViewportWidth,
21
+ exports.useWindowStore = windowStore.useWindowStore, exports.viewportHeight = windowStore.viewportHeight,
22
+ exports.viewportWidth = windowStore.viewportWidth, exports.createUploadsWorker = uploadsStore.createUploadsWorker,
12
23
  exports.getUploads = uploadsStore.getUploads, exports.getUploadsError = uploadsStore.getUploadsError,
13
24
  exports.getUploadsWorkerStatus = uploadsStore.getUploadsWorkerStatus, exports.uploadsActions = uploadsStore.uploadsActions,
14
25
  exports.uploadsInitialized = uploadsStore.uploadsInitialized, exports.useUploads = uploadsStore.useUploads,
@@ -1,7 +1,7 @@
1
1
  "use strict";
2
2
 
3
- var misc = require("../chunks/misc-C-M6KKsH.js"), colors = require("../chunks/colors-uej0anrN.js"), utils_objects = require("./objects/index.js");
3
+ var misc = require("../chunks/misc-C-M6KKsH.js"), colors = require("../chunks/colors-uej0anrN.js"), SSEConnection = require("../chunks/SSEConnection-B_yE8cXz.js"), WSConnection = require("../chunks/WSConnection-DCBuJGmb.js");
4
4
 
5
5
  require("../chunks/tslib.es6-C8dZW5nY.js"), exports.copyToClipboard = misc.copyToClipboard,
6
6
  exports.addOpacity = colors.addOpacity, exports.tintFromColor = colors.tintFromColor,
7
- exports.SSEConnection = utils_objects.SSEConnection;
7
+ exports.SSEConnection = SSEConnection.SSEConnection, exports.WSConnection = WSConnection.WSConnection;
@@ -1,140 +1,6 @@
1
1
  "use strict";
2
2
 
3
- exports.SSEConnection = class {
4
- /**
5
- * Whether the underlying EventSource is currently open.
6
- */
7
- get connected() {
8
- var _a;
9
- return (null === (_a = this.sseConnection) || void 0 === _a ? void 0 : _a.readyState) === EventSource.OPEN;
10
- }
11
- /**
12
- * Direct access to the underlying EventSource instance.
13
- */ get connection() {
14
- return this.sseConnection;
15
- }
16
- /**
17
- * Create an SEE connection instance
18
- */ constructor(options) {
19
- var _a, _b, _c;
20
- this.sseConnection = null, this.customEventHandlers = new Map, this.unifiedOnMessage = !1,
21
- /**
22
- * One message received
23
- */
24
- this.onMessage = event => {
25
- const data = this.parseEventData(event.data);
26
- this.emitUnifiedMessage({
27
- type: "message",
28
- data: data,
29
- event: event
30
- }), this.emitParsedMessage(data), this.shouldCloseFromMessage(event.data, data) && this.closeFromConnectionEvent();
31
- },
32
- /**
33
- * On error event
34
- */
35
- this.onError = event => {
36
- var _a;
37
- null === (_a = this.onErrorCallback) || void 0 === _a || _a.call(this, event), this.emitUnifiedMessage({
38
- type: "error",
39
- event: event
40
- });
41
- },
42
- /**
43
- * On open event
44
- */
45
- this.onOpen = event => {
46
- var _a;
47
- null === (_a = this.onOpenCallback) || void 0 === _a || _a.call(this, event), this.emitUnifiedMessage({
48
- type: "open",
49
- event: event
50
- });
51
- },
52
- /**
53
- * Close the SSE connection and release resources.
54
- */
55
- this.close = () => {
56
- this.sseConnection && (this.detachAllEventListeners(this.sseConnection), this.sseConnection.close(),
57
- this.sseConnection = null);
58
- }, this.url = null !== (_a = null == options ? void 0 : options.url) && void 0 !== _a ? _a : "",
59
- this.options = null !== (_b = null == options ? void 0 : options.options) && void 0 !== _b ? _b : void 0,
60
- this.unifiedOnMessage = null !== (_c = null == options ? void 0 : options.unifiedOnMessage) && void 0 !== _c && _c,
61
- this.onMessageCallback = null == options ? void 0 : options.onMessageCallback, this.onErrorCallback = null == options ? void 0 : options.onErrorCallback,
62
- this.onOpenCallback = null == options ? void 0 : options.onOpenCallback, this.onCloseCallback = null == options ? void 0 : options.onCloseCallback,
63
- this.connectionClose = null == options ? void 0 : options.connectionClose, (null == options ? void 0 : options.customEvents) ? this.customEvents = Array.isArray(null == options ? void 0 : options.customEvents) ? options.customEvents : [ options.customEvents ] : this.customEvents = [],
64
- this.sseConnection = new EventSource(this.url, this.options), this.attachDefaultEventListeners(this.sseConnection),
65
- this.customEvents.length > 0 && this.attachCustomEventListeners(this.customEvents);
66
- }
67
- /**
68
- * Safely parse SSE event data. Falls back to the raw string when the payload is not JSON.
69
- */ parseEventData(rawData) {
70
- try {
71
- return JSON.parse(rawData);
72
- } catch (_a) {
73
- return rawData;
74
- }
75
- }
76
- /**
77
- * Attach default SEE events
78
- */ attachDefaultEventListeners(connection) {
79
- connection.addEventListener("message", this.onMessage), connection.addEventListener("error", this.onError),
80
- connection.addEventListener("open", this.onOpen);
81
- }
82
- emitParsedMessage(data) {
83
- var _a;
84
- this.unifiedOnMessage || null === (_a = this.onMessageCallback) || void 0 === _a || _a.call(this, data);
85
- }
86
- emitUnifiedMessage(message) {
87
- var _a;
88
- this.unifiedOnMessage && (null === (_a = this.onMessageCallback) || void 0 === _a || _a.call(this, message));
89
- }
90
- emitCloseEvent(event) {
91
- var _a;
92
- null === (_a = this.onCloseCallback) || void 0 === _a || _a.call(this, event), this.emitUnifiedMessage({
93
- type: "close",
94
- event: event
95
- });
96
- }
97
- closeFromConnectionEvent() {
98
- const closeEvent = new Event("close");
99
- this.emitCloseEvent(closeEvent), this.close();
100
- }
101
- shouldCloseFromMessage(rawData, data) {
102
- var _a;
103
- return !!(null === (_a = this.connectionClose) || void 0 === _a ? void 0 : _a.message) && (rawData === this.connectionClose.message || data === this.connectionClose.message);
104
- }
105
- emitUnifiedCustomMessage(customEvent, data, event) {
106
- this.emitUnifiedMessage({
107
- type: customEvent.name,
108
- data: data,
109
- event: event
110
- });
111
- }
112
- /**
113
- * Attach custom event listeners to the SSE connection
114
- */ attachCustomEventListener(customEvent) {
115
- var _a;
116
- if (!this.sseConnection) return;
117
- const handler = eventInfo => {
118
- var _a, _b;
119
- const data = this.parseEventData(eventInfo.data);
120
- null === (_a = customEvent.handler) || void 0 === _a || _a.call(customEvent, data),
121
- this.emitUnifiedCustomMessage(customEvent, data, eventInfo), (null === (_b = this.connectionClose) || void 0 === _b ? void 0 : _b.event) === customEvent.name && this.closeFromConnectionEvent();
122
- }, currentHandlers = null !== (_a = this.customEventHandlers.get(customEvent.name)) && void 0 !== _a ? _a : [];
123
- currentHandlers.push(handler), this.customEventHandlers.set(customEvent.name, currentHandlers),
124
- this.sseConnection.addEventListener(customEvent.name, handler);
125
- }
126
- /**
127
- * Attach custom event listeners to the SSE connection
128
- */ attachCustomEventListeners(customEvents) {
129
- const events = Array.isArray(customEvents) ? customEvents : [ customEvents ];
130
- for (const event of events) this.attachCustomEventListener(event);
131
- }
132
- /**
133
- * Clean up listeners
134
- */ detachAllEventListeners(connection) {
135
- connection.removeEventListener("message", this.onMessage), connection.removeEventListener("error", this.onError),
136
- connection.removeEventListener("open", this.onOpen);
137
- for (const [eventName, handlers] of this.customEventHandlers.entries()) for (const handler of handlers) connection.removeEventListener(eventName, handler);
138
- this.customEventHandlers.clear();
139
- }
140
- };
3
+ var SSEConnection = require("../../chunks/SSEConnection-B_yE8cXz.js"), WSConnection = require("../../chunks/WSConnection-DCBuJGmb.js");
4
+
5
+ require("../../chunks/tslib.es6-C8dZW5nY.js"), exports.SSEConnection = SSEConnection.SSEConnection,
6
+ exports.WSConnection = WSConnection.WSConnection;
@@ -12,7 +12,7 @@ import { D as Dot } from "./Dot-CLGwQu-i.mjs";
12
12
 
13
13
  import { I as Icon } from "./_types-CTmvSEX0.mjs";
14
14
 
15
- import { P as ProgressIndicator } from "./ProgressIndicator-h11R3FG1.mjs";
15
+ import { P as ProgressIndicator } from "./ProgressIndicator-D2eairZl.mjs";
16
16
 
17
17
  import { T as ToolTipType } from "./sharedTypes-tn9-uJvb.mjs";
18
18
 
@@ -31,7 +31,7 @@ var css = {
31
31
  styleInject(".flexBox-module_row__z24tF {\n\tdisplay: flex;\n\tjustify-content: center;\n\talign-items: center;\n\tbox-sizing: border-box;\n\tpadding: 0;\n\tmargin: 0;\n}.flexBox-module_rowBetween__5FEvi {\n\tdisplay: flex;\n\tjustify-content: space-between;\n\talign-items: center;\n\tbox-sizing: border-box;\n\tpadding: 0;\n\tmargin: 0;\n}.flexBox-module_rowStart__4tcxS {\n\tdisplay: flex;\n\tjustify-content: flex-start;\n\talign-items: center;\n\tbox-sizing: border-box;\n\tpadding: 0;\n\tmargin: 0;\n}.flexBox-module_rowEnd__rVdVm {\n\tdisplay: flex;\n\tjustify-content: flex-end;\n\talign-items: center;\n\tbox-sizing: border-box;\n\tpadding: 0;\n\tmargin: 0;\n}.flexBox-module_column__ezvMq {\n\tdisplay: flex;\n\tflex-direction: column;\n\tjustify-content: center;\n\talign-items: center;\n\tbox-sizing: border-box;\n\tpadding: 0;\n\tmargin: 0;\n}.flexBox-module_columnStart__C7P44 {\n\tdisplay: flex;\n\tflex-direction: column;\n\tjustify-content: flex-start;\n\talign-items: flex-start;\n\tbox-sizing: border-box;\n\tpadding: 0;\n\tmargin: 0;\n}.flexBox-module_columnStartCenter__PKcrG {\n\tdisplay: flex;\n\tflex-direction: column;\n\tjustify-content: flex-start;\n\talign-items: center;\n\tbox-sizing: border-box;\n\tpadding: 0;\n\tmargin: 0;\n}.flexBox-module_columnBetween__ERfp7 {\n\tdisplay: flex;\n\tflex-direction: column;\n\tjustify-content: space-between;\n\talign-items: center;\n\tbox-sizing: border-box;\n\tpadding: 0;\n\tmargin: 0;\n}.flexBox-module_columnEnd__lLJuc {\n\tdisplay: flex;\n\tflex-direction: column;\n\tjustify-content: flex-end;\n\talign-items: flex-end;\n\tbox-sizing: border-box;\n\tpadding: 0;\n\tmargin: 0;\n}.type-module_body-xs-regular__ZAFft {\n\tfont-family: var(--font-family), sans-serif;\n\tfont-weight: var(--font-weight-regular);\n\tfont-size: var(--font-size-xs);\n\tline-height: 133.33%;\n\ttext-decoration: none;\n\tletter-spacing: 0.2px;\n}.type-module_body-xs-medium__s3KvF {\n\tfont-family: var(--font-family), sans-serif;\n\tfont-weight: var(--font-weight-medium);\n\tfont-size: var(--font-size-xs);\n\tline-height: 133.33%;\n\ttext-decoration: none;\n\tletter-spacing: 0.2px;\n}.type-module_body-xs-bold__Lhqqq {\n\tfont-family: var(--font-family), sans-serif;\n\tfont-weight: var(--font-weight-bold);\n\tfont-size: var(--font-size-xs);\n\tline-height: 133.33%;\n\ttext-decoration: none;\n\tletter-spacing: 0.25px;\n}.type-module_body-s-regular__vRHSP {\n\tfont-family: var(--font-family), sans-serif;\n\tfont-weight: var(--font-weight-regular);\n\tfont-size: var(--font-size-s);\n\tline-height: 142.86%;\n\ttext-decoration: none;\n\tletter-spacing: 0.15px;\n}.type-module_body-s-medium__tjdFc {\n\tfont-family: var(--font-family), sans-serif;\n\tfont-weight: var(--font-weight-medium);\n\tfont-size: var(--font-size-s);\n\tline-height: 142.86%;\n\ttext-decoration: none;\n\tletter-spacing: 0.15px;\n}.type-module_body-s-bold__Iy-VX {\n\tfont-family: var(--font-family), sans-serif;\n\tfont-weight: var(--font-weight-bold);\n\tfont-size: var(--font-size-s);\n\tline-height: 142.86%;\n\ttext-decoration: none;\n\tletter-spacing: 0.2px;\n}.type-module_body-m-regular__LuQBA {\n\tfont-family: var(--font-family), sans-serif;\n\tfont-weight: var(--font-weight-regular);\n\tfont-size: var(--font-size-m);\n\tline-height: 140%;\n\ttext-decoration: none;\n\tletter-spacing: 0.15px;\n}.type-module_body-m-medium__uW1on {\n\tfont-family: var(--font-family), sans-serif;\n\tfont-weight: var(--font-weight-medium);\n\tfont-size: var(--font-size-m);\n\tline-height: 140%;\n\ttext-decoration: none;\n\tletter-spacing: 0.15px;\n}.type-module_body-m-bold__UBcvQ {\n\tfont-family: var(--font-family), sans-serif;\n\tfont-weight: var(--font-weight-bold);\n\tfont-size: var(--font-size-m);\n\tline-height: 140%;\n\ttext-decoration: none;\n\tletter-spacing: 0.2px;\n}.type-module_body-l-regular__lOYbg {\n\tfont-family: var(--font-family), sans-serif;\n\tfont-weight: var(--font-weight-regular);\n\tfont-size: var(--font-size-l);\n\tline-height: 162.5%;\n\ttext-decoration: none;\n\tletter-spacing: 0.1px;\n}.type-module_body-l-medium__BqRC7 {\n\tfont-family: var(--font-family), sans-serif;\n\tfont-weight: var(--font-weight-medium);\n\tfont-size: var(--font-size-l);\n\tline-height: 162.5%;\n\ttext-decoration: none;\n\tletter-spacing: 0.1px;\n}.type-module_body-l-bold__Fh2dt {\n\tfont-family: var(--font-family), sans-serif;\n\tfont-weight: var(--font-weight-bold);\n\tfont-size: var(--font-size-l);\n\tline-height: 162.5%;\n\ttext-decoration: none;\n\tletter-spacing: 0.15px;\n}.type-module_body-xl-regular__pF2kC {\n\tfont-family: var(--font-family), sans-serif;\n\tfont-weight: var(--font-weight-regular);\n\tfont-size: var(--font-size-xl);\n\tline-height: 162.5%;\n\ttext-decoration: none;\n\tletter-spacing: 0.1px;\n}.type-module_body-xl-medium__BeyrH {\n\tfont-family: var(--font-family), sans-serif;\n\tfont-weight: var(--font-weight-medium);\n\tfont-size: var(--font-size-xl);\n\tline-height: 162.5%;\n\ttext-decoration: none;\n\tletter-spacing: 0.1px;\n}.type-module_body-xl-bold__Ruknj {\n\tfont-family: var(--font-family), sans-serif;\n\tfont-weight: var(--font-weight-bold);\n\tfont-size: var(--font-size-xl);\n\tline-height: 162.5%;\n\ttext-decoration: none;\n\tletter-spacing: 0.15px;\n}.type-module_heading-s-medium__z8L3G {\n\tfont-family: var(--font-family), sans-serif;\n\tfont-weight: 500;\n\tfont-size: 20px;\n\tline-height: 140%;\n\ttext-decoration: none;\n\tletter-spacing: 0.2px;\n}.type-module_heading-s-bold__0O3g6 {\n\tfont-family: var(--font-family), sans-serif;\n\tfont-weight: 600;\n\tfont-size: 20px;\n\tline-height: 140%;\n\ttext-decoration: none;\n\tletter-spacing: 0.2px;\n}.type-module_heading-m-bold__KXxEB {\n\tfont-family: var(--font-family), sans-serif;\n\tfont-weight: 500;\n\tfont-size: 24px;\n\tline-height: 116.67%;\n\ttext-decoration: none;\n\tletter-spacing: 0.2px;\n}.type-module_heading-m-medium__cJeEA {\n\tfont-family: var(--font-family), sans-serif;\n\tfont-weight: 600;\n\tfont-size: 24px;\n\tline-height: 116.67%;\n\ttext-decoration: none;\n\tletter-spacing: 0.2px;\n}.type-module_heading-l-medium__eRe05 {\n\tfont-family: var(--font-family), sans-serif;\n\tfont-weight: 500;\n\tfont-size: 30px;\n\tline-height: 128.57%;\n\ttext-decoration: none;\n\tletter-spacing: 0.2px;\n}.type-module_heading-l-bold__Xmwtf {\n\tfont-family: var(--font-family), sans-serif;\n\tfont-weight: 600;\n\tfont-size: 30px;\n\tline-height: 128.57%;\n\ttext-decoration: none;\n\tletter-spacing: 0.2px;\n}.type-module_heading-xl-medium__5q1m3 {\n\tfont-family: var(--font-family), sans-serif;\n\tfont-weight: 500;\n\tfont-size: 36px;\n\tline-height: 128.57%;\n\ttext-decoration: none;\n\tletter-spacing: 0.2px;\n}.type-module_heading-xl-bold__k9VFV {\n\tfont-family: var(--font-family), sans-serif;\n\tfont-weight: 600;\n\tfont-size: 36px;\n\tline-height: 128.57%;\n\ttext-decoration: none;\n\tletter-spacing: 0.2px;\n}\n\n.Button-module_button__2ZuB7 {\n\tposition: relative;\n\tuser-select: none;\n\tmin-width: var(--ui-button-min-width);\n\t-webkit-user-select: none;\n}\n\n.Button-module_label__UJ3Zt {\n\tuser-select: none;\n\t-webkit-user-select: none;\n\ttext-overflow: ellipsis;\n\toverflow: hidden;\n\twhite-space: nowrap;\n\tword-break: break-all;\n\tdisplay: -webkit-box;\n\t-webkit-line-clamp: 1;\n\t-webkit-box-orient: vertical;\n\t&:hover {\n\t\ttext-decoration: var(--ui-button-decoration);\n\t}\n}\n\n.Button-module_count__DFxVB {\n\tposition: absolute;\n\ttop: 0;\n\tright: 0;\n\ttransform: translateX(10px) translateY(-2px);\n}\n\n.Button-module_icon__-43u5 {\n\tmin-width: var(--ui-button-icon-size);\n\tmin-height: var(--ui-button-icon-size);\n\theight: var(--ui-button-icon-size);\n\twidth: var(--ui-button-icon-size);\n}\n\n.Button-module_m__DR-gs {\n}\n\n.Button-module_l__0E0yI {\n}\n\n.Button-module_s__dSKOL {\n}\n");
32
32
 
33
33
  const ButtonComponent = forwardRef((props, buttonRef) => {
34
- const {size: size = "medium", variant: variant = "outline", label: label, labelSize: labelSize = "m", iconRight: iconRight, iconLeft: iconLeft, count: count = (void 0 === props.count ? void 0 : Number(props.count)), showDot: showDot, tooltip: tooltip, round: round = !1, state: state = "normal", fill: fill = !1, iconSize: iconSize = (void 0 === props.iconSize ? 20 : Number(props.iconSize)), width: width = "auto", underline: underline = !1, borderRadius: borderRadius, iconColor: iconColor, bgColor: bgColor, bgColorDisabled: bgColorDisabled, labelColor: labelColor, transition: transition, variants: variants, initial: initial, animate: animate, exit: exit, paddingRight: paddingRight, paddingLeft: paddingLeft, progress: progress = !1, working: working = !1, duration: duration, trigger: trigger = !1, destructive: destructive = !1, onClick: onClick = () => null, onToolTip: onToolTip = () => null} = props, divAttributes = __rest(props, [ "size", "variant", "label", "labelSize", "iconRight", "iconLeft", "count", "showDot", "tooltip", "round", "state", "fill", "iconSize", "width", "underline", "borderRadius", "iconColor", "bgColor", "bgColorDisabled", "labelColor", "transition", "variants", "initial", "animate", "exit", "paddingRight", "paddingLeft", "progress", "working", "duration", "trigger", "destructive", "onClick", "onToolTip" ]), {id: divId, className: className, style: style} = divAttributes, rest = __rest(divAttributes, [ "id", "className", "style" ]), divStyle = null != style ? style : {}, divClass = className ? ` ${className}` : "", [btnState, setBtnState] = useState(state), [btnWidth, setBtnWidth] = useState(void 0), [playing, setPlaying] = useState(working), ref = useRef(null), handleClick = useCallback(e => {
34
+ const {size: size = "medium", variant: variant = "outline", label: label, labelSize: labelSize = "m", iconRight: iconRight, iconLeft: iconLeft, count: count = (void 0 === props.count ? void 0 : Number(props.count)), showDot: showDot, tooltip: tooltip, round: round = !1, state: state = "normal", fill: fill = !1, iconSize: iconSize = (void 0 === props.iconSize ? 20 : Number(props.iconSize)), width: width = "min-content", underline: underline = !1, borderRadius: borderRadius, iconColor: iconColor, bgColor: bgColor, bgColorDisabled: bgColorDisabled, labelColor: labelColor, transition: transition, variants: variants, initial: initial, animate: animate, exit: exit, paddingRight: paddingRight, paddingLeft: paddingLeft, progress: progress = !1, working: working = !1, duration: duration, trigger: trigger = !1, destructive: destructive = !1, onClick: onClick = () => null, onToolTip: onToolTip = () => null} = props, divAttributes = __rest(props, [ "size", "variant", "label", "labelSize", "iconRight", "iconLeft", "count", "showDot", "tooltip", "round", "state", "fill", "iconSize", "width", "underline", "borderRadius", "iconColor", "bgColor", "bgColorDisabled", "labelColor", "transition", "variants", "initial", "animate", "exit", "paddingRight", "paddingLeft", "progress", "working", "duration", "trigger", "destructive", "onClick", "onToolTip" ]), {id: divId, className: className, style: style} = divAttributes, rest = __rest(divAttributes, [ "id", "className", "style" ]), divStyle = null != style ? style : {}, divClass = className ? ` ${className}` : "", [btnState, setBtnState] = useState(state), [btnWidth, setBtnWidth] = useState(void 0), [playing, setPlaying] = useState(working), ref = useRef(null), handleClick = useCallback(e => {
35
35
  onToolTip(null), "disabled" !== btnState && (progress && duration ? setPlaying(!0) : onClick(e));
36
36
  }, [ onToolTip, btnState, progress, duration, onClick ]);
37
37
  useEffect(() => setBtnState(state), [ state ]), useEffect(() => setPlaying(working), [ working ]),
@@ -171,6 +171,8 @@ const ButtonComponent = forwardRef((props, buttonRef) => {
171
171
  maxHeight: sizingStyles[size].height,
172
172
  minHeight: sizingStyles[size].height,
173
173
  flex: "fill" === width ? 1 : "unset",
174
+ width: width && "fill" !== width ? width : "min-content",
175
+ maxWidth: width && "fill" !== width ? width : "min-content",
174
176
  gap: sizingStyles[size].gap,
175
177
  borderWidth: colorStyles[variant].border,
176
178
  borderStyle: "solid",
@@ -10,7 +10,7 @@ import { F as FileIcon } from "./FileIcon-CC_k5dUW.mjs";
10
10
 
11
11
  import { I as Icon } from "./_types-CTmvSEX0.mjs";
12
12
 
13
- import { P as ProgressIndicator } from "./ProgressIndicator-h11R3FG1.mjs";
13
+ import { P as ProgressIndicator } from "./ProgressIndicator-D2eairZl.mjs";
14
14
 
15
15
  import { s as styleInject } from "./style-inject.es-D0BjEaN8.mjs";
16
16
 
@@ -8,12 +8,12 @@ import "../theme/colors.mjs";
8
8
 
9
9
  import "../hooks/useWindow.mjs";
10
10
 
11
- import { B as Button } from "./Button-DJDS7Yad.mjs";
12
-
13
- import { F as FileList } from "./FileList-CmlXqPXl.mjs";
11
+ import { B as Button } from "./Button-kXFJmcKv.mjs";
14
12
 
15
13
  import { s as styleInject } from "./style-inject.es-D0BjEaN8.mjs";
16
14
 
15
+ import { F as FileList } from "./FileList-Bon537-t.mjs";
16
+
17
17
  var css = {
18
18
  wrapperBg: "PromptInput-module_wrapperBg__zabZq flexBox-module_columnStart__C7P44",
19
19
  bgRotate: "PromptInput-module_bgRotate__Um720",
@@ -0,0 +1,140 @@
1
+ class SSEConnection {
2
+ /**
3
+ * Whether the underlying EventSource is currently open.
4
+ */
5
+ get connected() {
6
+ var _a;
7
+ return (null === (_a = this.sseConnection) || void 0 === _a ? void 0 : _a.readyState) === EventSource.OPEN;
8
+ }
9
+ /**
10
+ * Direct access to the underlying EventSource instance.
11
+ */ get connection() {
12
+ return this.sseConnection;
13
+ }
14
+ /**
15
+ * Create an SEE connection instance
16
+ */ constructor(options) {
17
+ var _a, _b, _c;
18
+ this.sseConnection = null, this.customEventHandlers = new Map, this.unifiedOnMessage = !1,
19
+ /**
20
+ * One message received
21
+ */
22
+ this.onMessage = event => {
23
+ const data = this.parseEventData(event.data);
24
+ this.emitUnifiedMessage({
25
+ type: "message",
26
+ data: data,
27
+ event: event
28
+ }), this.emitParsedMessage(data), this.shouldCloseFromMessage(event.data, data) && this.closeFromConnectionEvent();
29
+ },
30
+ /**
31
+ * On error event
32
+ */
33
+ this.onError = event => {
34
+ var _a;
35
+ null === (_a = this.onErrorCallback) || void 0 === _a || _a.call(this, event), this.emitUnifiedMessage({
36
+ type: "error",
37
+ event: event
38
+ });
39
+ },
40
+ /**
41
+ * On open event
42
+ */
43
+ this.onOpen = event => {
44
+ var _a;
45
+ null === (_a = this.onOpenCallback) || void 0 === _a || _a.call(this, event), this.emitUnifiedMessage({
46
+ type: "open",
47
+ event: event
48
+ });
49
+ },
50
+ /**
51
+ * Close the SSE connection and release resources.
52
+ */
53
+ this.close = () => {
54
+ this.sseConnection && (this.detachAllEventListeners(this.sseConnection), this.sseConnection.close(),
55
+ this.sseConnection = null);
56
+ }, this.url = null !== (_a = null == options ? void 0 : options.url) && void 0 !== _a ? _a : "",
57
+ this.options = null !== (_b = null == options ? void 0 : options.options) && void 0 !== _b ? _b : void 0,
58
+ this.unifiedOnMessage = null !== (_c = null == options ? void 0 : options.unifiedOnMessage) && void 0 !== _c && _c,
59
+ this.onMessageCallback = null == options ? void 0 : options.onMessageCallback, this.onErrorCallback = null == options ? void 0 : options.onErrorCallback,
60
+ this.onOpenCallback = null == options ? void 0 : options.onOpenCallback, this.onCloseCallback = null == options ? void 0 : options.onCloseCallback,
61
+ this.connectionClose = null == options ? void 0 : options.connectionClose, (null == options ? void 0 : options.customEvents) ? this.customEvents = Array.isArray(null == options ? void 0 : options.customEvents) ? options.customEvents : [ options.customEvents ] : this.customEvents = [],
62
+ this.sseConnection = new EventSource(this.url, this.options), this.attachDefaultEventListeners(this.sseConnection),
63
+ this.customEvents.length > 0 && this.attachCustomEventListeners(this.customEvents);
64
+ }
65
+ /**
66
+ * Safely parse SSE event data. Falls back to the raw string when the payload is not JSON.
67
+ */ parseEventData(rawData) {
68
+ try {
69
+ return JSON.parse(rawData);
70
+ } catch (_a) {
71
+ return rawData;
72
+ }
73
+ }
74
+ /**
75
+ * Attach default SEE events
76
+ */ attachDefaultEventListeners(connection) {
77
+ connection.addEventListener("message", this.onMessage), connection.addEventListener("error", this.onError),
78
+ connection.addEventListener("open", this.onOpen);
79
+ }
80
+ emitParsedMessage(data) {
81
+ var _a;
82
+ this.unifiedOnMessage || null === (_a = this.onMessageCallback) || void 0 === _a || _a.call(this, data);
83
+ }
84
+ emitUnifiedMessage(message) {
85
+ var _a;
86
+ this.unifiedOnMessage && (null === (_a = this.onMessageCallback) || void 0 === _a || _a.call(this, message));
87
+ }
88
+ emitCloseEvent(event) {
89
+ var _a;
90
+ null === (_a = this.onCloseCallback) || void 0 === _a || _a.call(this, event), this.emitUnifiedMessage({
91
+ type: "close",
92
+ event: event
93
+ });
94
+ }
95
+ closeFromConnectionEvent() {
96
+ const closeEvent = new Event("close");
97
+ this.emitCloseEvent(closeEvent), this.close();
98
+ }
99
+ shouldCloseFromMessage(rawData, data) {
100
+ var _a;
101
+ return !!(null === (_a = this.connectionClose) || void 0 === _a ? void 0 : _a.message) && (rawData === this.connectionClose.message || data === this.connectionClose.message);
102
+ }
103
+ emitUnifiedCustomMessage(customEvent, data, event) {
104
+ this.emitUnifiedMessage({
105
+ type: customEvent.name,
106
+ data: data,
107
+ event: event
108
+ });
109
+ }
110
+ /**
111
+ * Attach custom event listeners to the SSE connection
112
+ */ attachCustomEventListener(customEvent) {
113
+ var _a;
114
+ if (!this.sseConnection) return;
115
+ const handler = eventInfo => {
116
+ var _a, _b;
117
+ const data = this.parseEventData(eventInfo.data);
118
+ null === (_a = customEvent.handler) || void 0 === _a || _a.call(customEvent, data),
119
+ this.emitUnifiedCustomMessage(customEvent, data, eventInfo), (null === (_b = this.connectionClose) || void 0 === _b ? void 0 : _b.event) === customEvent.name && this.closeFromConnectionEvent();
120
+ }, currentHandlers = null !== (_a = this.customEventHandlers.get(customEvent.name)) && void 0 !== _a ? _a : [];
121
+ currentHandlers.push(handler), this.customEventHandlers.set(customEvent.name, currentHandlers),
122
+ this.sseConnection.addEventListener(customEvent.name, handler);
123
+ }
124
+ /**
125
+ * Attach custom event listeners to the SSE connection
126
+ */ attachCustomEventListeners(customEvents) {
127
+ const events = Array.isArray(customEvents) ? customEvents : [ customEvents ];
128
+ for (const event of events) this.attachCustomEventListener(event);
129
+ }
130
+ /**
131
+ * Clean up listeners
132
+ */ detachAllEventListeners(connection) {
133
+ connection.removeEventListener("message", this.onMessage), connection.removeEventListener("error", this.onError),
134
+ connection.removeEventListener("open", this.onOpen);
135
+ for (const [eventName, handlers] of this.customEventHandlers.entries()) for (const handler of handlers) connection.removeEventListener(eventName, handler);
136
+ this.customEventHandlers.clear();
137
+ }
138
+ }
139
+
140
+ export { SSEConnection as S };
@@ -4,7 +4,7 @@ import { jsxs, jsx } from "react/jsx-runtime";
4
4
 
5
5
  import React, { useState, useRef, useCallback, useEffect, useMemo } from "react";
6
6
 
7
- import { B as Button } from "./Button-DJDS7Yad.mjs";
7
+ import { B as Button } from "./Button-kXFJmcKv.mjs";
8
8
 
9
9
  import { s as styleInject } from "./style-inject.es-D0BjEaN8.mjs";
10
10
 
@@ -12,7 +12,7 @@ import "../theme/colors.mjs";
12
12
 
13
13
  import "../hooks/useWindow.mjs";
14
14
 
15
- import { B as Button } from "./Button-DJDS7Yad.mjs";
15
+ import { B as Button } from "./Button-kXFJmcKv.mjs";
16
16
 
17
17
  import { I as Icon } from "./_types-CTmvSEX0.mjs";
18
18
 
@@ -66,7 +66,7 @@ const MOTION_CONFIG = {
66
66
  error: "var(--feedback-warning)",
67
67
  placeholder: "var(--core-text-disabled)",
68
68
  disabled: "var(--core-text-disabled)",
69
- label: "var(--core-text-tertiary)"
69
+ label: "var(--core-text-primary)"
70
70
  }, iconLeft: iconLeft = null, clearButton: clearButton = {
71
71
  size: 20
72
72
  }, clearBlurs: clearBlurs = !1, disabled: disabled = !1, inputType: inputType = "text"} = props, divAttributes = __rest(props, [ "name", "value", "label", "labelSize", "textSize", "placeholder", "focused", "onSubmit", "onChange", "onBlur", "onFocus", "onKeydown", "onAction", "onPaste", "onClear", "onValidate", "actionButton", "maxLength", "size", "padding", "borderRadius", "editable", "textAlign", "isValid", "inline", "noShow", "borderType", "validate", "borderColor", "backgroundColor", "color", "iconLeft", "clearButton", "clearBlurs", "disabled", "inputType" ]), {id: divId, className: className, style: style} = divAttributes, rest = __rest(divAttributes, [ "id", "className", "style" ]), divStyle = null != style ? style : {}, divClass = className ? ` ${className}` : "", input = useRef(null), [text, setText] = useState(value), [isFocused, setIsFocused] = useState(focused), [valid, setValid] = useState(isValid), [show, setShow] = useState(!1);
@@ -85,17 +85,19 @@ const MOTION_CONFIG = {
85
85
  (null == input ? void 0 : input.current) && (clearBlurs || input.current.focus(),
86
86
  setText(""), textIsValid("")), onChange(""), onClear();
87
87
  }, [ clearBlurs, onChange, onClear, textIsValid ]), handleValueChange = useCallback(newValue => {
88
- setText(newValue), onChange(newValue), valid || textIsValid(text);
89
- }, [ onChange, textIsValid, text, valid ]), handleBlur = useCallback(() => {
90
- textIsValid(text), setIsFocused(!1), onBlur(text);
91
- }, [ text, onBlur, textIsValid ]), handleKeyDown = useCallback(e => {
88
+ disabled || (setText(newValue), onChange(newValue), valid || textIsValid(text));
89
+ }, [ onChange, textIsValid, text, valid, disabled ]), handleBlur = useCallback(() => {
90
+ disabled || (textIsValid(text), setIsFocused(!1), onBlur(text));
91
+ }, [ text, onBlur, textIsValid, disabled ]), handleKeyDown = useCallback(e => {
92
92
  var _a;
93
- if ("Enter" === e.key && (handleBlur(), onSubmit(text), null === (_a = input.current) || void 0 === _a || _a.blur()),
94
- disabled) return e.preventDefault(), !0;
95
- onKeydown(e.key, e);
93
+ if (!disabled) {
94
+ if ("Enter" === e.key && (handleBlur(), onSubmit(text), null === (_a = input.current) || void 0 === _a || _a.blur()),
95
+ disabled) return e.preventDefault(), !0;
96
+ onKeydown(e.key, e);
97
+ }
96
98
  }, [ text, disabled, onSubmit, onKeydown, handleBlur ]), handleFocus = useCallback(() => {
97
- setIsFocused(!0), onFocus(text);
98
- }, [ text, onFocus ]), toggleShow = useCallback(() => {
99
+ disabled || (setIsFocused(!0), onFocus(text));
100
+ }, [ text, onFocus, disabled ]), toggleShow = useCallback(() => {
99
101
  setShow(prev => !prev);
100
102
  }, []), iconContainerStyle = useMemo(() => iconLeft ? {
101
103
  width: iconLeft.size,
@@ -113,7 +115,7 @@ const MOTION_CONFIG = {
113
115
  var _a, _b, _c;
114
116
  return validate && !valid ? null !== (_a = color.error) && void 0 !== _a ? _a : "var(--core-text-primary)" : isFocused ? null !== (_b = color.focused) && void 0 !== _b ? _b : "var(--core-text-primary)" : null !== (_c = color.blurred) && void 0 !== _c ? _c : "var(--core-text-primary)";
115
117
  }, [ isFocused, valid, color, validate ]), setTextAlign = useMemo(() => null != textAlign ? textAlign : "left", [ textAlign ]), setShowOpacity = useMemo(() => "password" !== inputType ? "0" : isFocused ? "1" : "0.5", [ inputType, isFocused ]), cssVars = useMemo(() => {
116
- var _a, _b;
118
+ var _a;
117
119
  return {
118
120
  "--tf-width": setStyleValue(size.width),
119
121
  "--tf-height": setStyleValue(size.height),
@@ -123,12 +125,12 @@ const MOTION_CONFIG = {
123
125
  "--tf-bg-color": setBackgroundColor,
124
126
  "--tf-box-shadow": setBoxShadow,
125
127
  "--tf-color": textColor,
126
- "--tf-label-color": null !== (_a = color.label) && void 0 !== _a ? _a : "var(--core-text-disabled)",
128
+ "--tf-label-color": disabled ? "var(--core-text-disabled)" : color.label,
127
129
  "--tf-text-align": setTextAlign,
128
130
  "--tf-show-opacity": setShowOpacity,
129
- "--tf-placeholder-color": null !== (_b = color.placeholder) && void 0 !== _b ? _b : "var(--core-text-disabled)"
131
+ "--tf-placeholder-color": null !== (_a = color.placeholder) && void 0 !== _a ? _a : "var(--core-text-disabled)"
130
132
  };
131
- }, [ size, padding, label, borderRadius, setStyleValue, setBackgroundColor, setBoxShadow, textColor, setTextAlign, setShowOpacity, color ]);
133
+ }, [ size, padding, label, borderRadius, setStyleValue, setBackgroundColor, setBoxShadow, textColor, setTextAlign, setShowOpacity, color, disabled ]);
132
134
  return jsxs("div", Object.assign({
133
135
  id: divId,
134
136
  className: `${css.wrapper}${divClass}`,
@@ -163,7 +165,7 @@ const MOTION_CONFIG = {
163
165
  onFocus: handleFocus,
164
166
  onBlur: handleBlur,
165
167
  onMouseDown: e => e.stopPropagation(),
166
- disabled: !editable,
168
+ disabled: !editable || disabled,
167
169
  maxLength: maxLength
168
170
  }), jsx(AnimatePresence, {
169
171
  initial: !1,
@@ -4,14 +4,14 @@ import React, { useState, useRef, useCallback, useMemo } from "react";
4
4
 
5
5
  import { s as setStyle, a as accessibleKeyDown } from "./misc-cg9I7drO.mjs";
6
6
 
7
- import { F as FileList } from "./FileList-CmlXqPXl.mjs";
8
-
9
7
  import { I as Icon } from "./_types-CTmvSEX0.mjs";
10
8
 
11
- import { P as ProgressIndicator } from "./ProgressIndicator-h11R3FG1.mjs";
9
+ import { P as ProgressIndicator } from "./ProgressIndicator-D2eairZl.mjs";
12
10
 
13
11
  import { s as styleInject } from "./style-inject.es-D0BjEaN8.mjs";
14
12
 
13
+ import { F as FileList } from "./FileList-Bon537-t.mjs";
14
+
15
15
  var css = {
16
16
  wrapper: "UploadArea-module_wrapper__aircC flexBox-module_column__ezvMq",
17
17
  icon: "UploadArea-module_icon__M7n-m flexBox-module_row__z24tF",