@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.
- package/README.md +47 -77
- package/dist/cjs/chunks/{Button-hg5kGC1P.js → Button-krf4dQeL.js} +4 -2
- package/dist/cjs/chunks/{FileList-BQgcnKPP.js → FileList-CkpMj-os.js} +1 -1
- package/dist/cjs/chunks/{ProgressIndicator-qjya_Yb5.js → ProgressIndicator-DVD-gD3T.js} +1 -1
- package/dist/cjs/chunks/{PromptInput-ZqHQUfXw.js → PromptInput-DULf5ock.js} +1 -1
- package/dist/cjs/chunks/SSEConnection-B_yE8cXz.js +140 -0
- package/dist/cjs/chunks/{TextArea-BhzVGfKA.js → TextArea-BJCjRUEG.js} +1 -1
- package/dist/cjs/chunks/{TextField-hIjxrOG9.js → TextField-CjT26H_6.js} +18 -16
- package/dist/cjs/chunks/{UploadArea-B4GA06LW.js → UploadArea-BE6but3t.js} +1 -1
- package/dist/cjs/chunks/WSConnection-DCBuJGmb.js +206 -0
- package/dist/cjs/chunks/{sseStore-Dg0WuXsI.js → sseStore-CIIeshjm.js} +3 -3
- package/dist/cjs/chunks/windowStore-CCxCOUqa.js +156 -0
- package/dist/cjs/components/Button/index.js +2 -2
- package/dist/cjs/components/FileList/index.js +2 -2
- package/dist/cjs/components/Progress/index.js +2 -2
- package/dist/cjs/components/PromptInput/index.js +4 -4
- package/dist/cjs/components/TextArea/index.js +3 -3
- package/dist/cjs/components/Textfield/index.js +3 -3
- package/dist/cjs/components/UploadArea/index.js +7 -8
- package/dist/cjs/hooks/useWindow.js +46 -11
- package/dist/cjs/index.js +2 -2
- package/dist/cjs/stores/SSE.js +2 -2
- package/dist/cjs/stores/WS.js +62 -0
- package/dist/cjs/stores/window.js +14 -3
- package/dist/cjs/stores.js +15 -4
- package/dist/cjs/utils/index.js +2 -2
- package/dist/cjs/utils/objects/index.js +4 -138
- package/dist/esm/chunks/{Button-DJDS7Yad.mjs → Button-kXFJmcKv.mjs} +4 -2
- package/dist/esm/chunks/{FileList-CmlXqPXl.mjs → FileList-Bon537-t.mjs} +1 -1
- package/dist/esm/chunks/{PromptInput-DSHVUuEf.mjs → PromptInput-DXFAZspz.mjs} +3 -3
- package/dist/esm/chunks/SSEConnection-Dj9P0SWE.mjs +140 -0
- package/dist/esm/chunks/{TextArea-CyVBzMoN.mjs → TextArea-DBmM6aQm.mjs} +1 -1
- package/dist/esm/chunks/{TextField-CYI2vbvO.mjs → TextField-DyUTMegV.mjs} +18 -16
- package/dist/esm/chunks/{UploadArea-Kez3VD4d.mjs → UploadArea-tT5V8q23.mjs} +3 -3
- package/dist/esm/chunks/WSConnection-DlYSitff.mjs +206 -0
- package/dist/esm/chunks/{sseStore-m3IPyLwJ.mjs → sseStore-DdqmnAAf.mjs} +2 -2
- package/dist/esm/chunks/windowStore-BOTh1g37.mjs +148 -0
- package/dist/esm/components/Button/index.mjs +2 -2
- package/dist/esm/components/FileList/index.mjs +2 -2
- package/dist/esm/components/Progress/index.mjs +3 -3
- package/dist/esm/components/PromptInput/index.mjs +4 -4
- package/dist/esm/components/TextArea/index.mjs +3 -3
- package/dist/esm/components/Textfield/index.mjs +3 -3
- package/dist/esm/components/UploadArea/index.mjs +7 -7
- package/dist/esm/hooks/useWindow.mjs +47 -11
- package/dist/esm/index.mjs +7 -7
- package/dist/esm/stores/SSE.mjs +2 -2
- package/dist/esm/stores/WS.mjs +59 -0
- package/dist/esm/stores/window.mjs +3 -1
- package/dist/esm/stores.mjs +5 -5
- package/dist/esm/utils/index.mjs +3 -1
- package/dist/esm/utils/objects/index.mjs +4 -139
- package/dist/types/hooks/index.d.ts +1 -1
- package/dist/types/hooks/useWindow/useWindow.d.ts +19 -0
- package/dist/types/index.d.ts +1 -1
- package/dist/types/stores/WS/_types.d.ts +17 -0
- package/dist/types/stores/WS/index.d.ts +2 -0
- package/dist/types/stores/WS/wsStore.d.ts +19 -0
- package/dist/types/stores/window/_types.d.ts +5 -0
- package/dist/types/stores/window/index.d.ts +3 -2
- package/dist/types/stores/window/windowStore.d.ts +8 -0
- package/dist/types/utils/index.d.ts +2 -2
- package/dist/types/utils/objects/WSConnection/WSConnection.d.ts +147 -0
- package/dist/types/utils/objects/index.d.ts +2 -0
- package/package.json +1 -1
- package/dist/cjs/chunks/windowStore-RaJswiHM.js +0 -70
- package/dist/esm/chunks/windowStore-CwW0i_le.mjs +0 -71
- package/dist/esm/chunks/{ProgressIndicator-h11R3FG1.mjs → ProgressIndicator-D2eairZl.mjs} +2 -2
package/README.md
CHANGED
|
@@ -13,8 +13,8 @@ Slice is a TypeScript-first React UI kit with theme tokens, utility hooks, optio
|
|
|
13
13
|
- 30+ reusable UI components (inputs, buttons, navigation, overlays, feedback, layout, icons, upload UI, camera/stream UI)
|
|
14
14
|
- Theme system with light/dark presets and typed theme tokens
|
|
15
15
|
- React hooks for theme, window sizing, keyboard shortcuts, local storage, resize, and more
|
|
16
|
-
- Optional Zustand-powered stores (`
|
|
17
|
-
- Utility functions and low-level objects such as `SSEConnection`
|
|
16
|
+
- Optional Zustand-powered stores (`tip`, `uploads`, `window`, `SSE`, `WS`)
|
|
17
|
+
- Utility functions and low-level objects such as `SSEConnection` and `WSConnection`
|
|
18
18
|
- Rollup + TypeScript build pipeline for CJS, ESM, and declaration output
|
|
19
19
|
- Component performance benchmarks powered by Vitest
|
|
20
20
|
|
|
@@ -98,12 +98,6 @@ Subpath imports are also published:
|
|
|
98
98
|
- `TextField`, `TextArea`, `Tip`, `Toast`, `Button`, `ButtonBar`
|
|
99
99
|
- `Card`, `Chip`, `Label`, `DocIcons`, `DraggablePanel`, `UploadArea`
|
|
100
100
|
|
|
101
|
-
Camera notes:
|
|
102
|
-
|
|
103
|
-
- `Camera` exposes both `CameraProps` and an imperative `CameraElement` ref handle
|
|
104
|
-
- Use the forwarded ref for low-level stream access (`stream`, `videoTrack`, `audioTrack`) and imperative controls such as `startCamera()`, `stopCamera()`, `toggleVideo()`, `toggleMic()`, and `snapshot()`
|
|
105
|
-
- Preferred devices can be supplied through `sessionSettings.videoDeviceId` and `sessionSettings.micDeviceId`
|
|
106
|
-
|
|
107
101
|
Example:
|
|
108
102
|
|
|
109
103
|
```tsx
|
|
@@ -144,64 +138,67 @@ export function CameraExample() {
|
|
|
144
138
|
- `useToolTip`
|
|
145
139
|
- `useLastUpdated`
|
|
146
140
|
- `useLocalStore`
|
|
147
|
-
- `useWindow`
|
|
141
|
+
- `useWindow` with optional geolocation helpers (`geolocationSupported`, `location`, `locationError`, `gettingLocation`, `requestGeolocation`)
|
|
148
142
|
- `useObserveResize`
|
|
149
143
|
|
|
150
144
|
## Stores (optional)
|
|
151
145
|
|
|
152
|
-
- `toast` store: `useToast`, `useToastActions`, `toastActions`, `getToast`
|
|
153
146
|
- `tip` store: `useTip`, `useTipActions`, `tipActions`, `getTip`
|
|
154
147
|
- `SSE` store: `useSSEStore`, `useSSE`, `useMessage`, `useConnectionMessage`, `useConnectionClose`, `useIsConnected`
|
|
155
|
-
- `
|
|
148
|
+
- `WS` store: `useWSStore`, `useWS`, `useMessage`, `useConnectionMessage`, `useConnectionClose`, `useIsConnected`
|
|
149
|
+
- `window` store: `useWindowStore`, atomic viewport/runtime hooks, imperative viewport helpers, and explicit location actions/selectors
|
|
156
150
|
- `uploads` store: `useUploadsStore`, `useUploads`, `useUploadsActions`, `createUploadsWorker`, `uploadsActions`
|
|
157
151
|
|
|
158
|
-
Example:
|
|
159
|
-
|
|
160
|
-
```ts
|
|
161
|
-
import { useToast, useToastActions } from '@apple-pie/slice/stores/toast';
|
|
162
|
-
```
|
|
163
|
-
|
|
164
|
-
SSE store example:
|
|
165
|
-
|
|
166
|
-
```tsx
|
|
167
|
-
import { useEffect } from 'react';
|
|
168
|
-
import {
|
|
169
|
-
useSSE,
|
|
170
|
-
useIsConnected,
|
|
171
|
-
useMessage,
|
|
172
|
-
} from '@apple-pie/slice/stores/SSE';
|
|
173
|
-
|
|
174
|
-
function StreamingExample() {
|
|
175
|
-
const { addConnection, removeConnection } = useSSE();
|
|
176
|
-
const connected = useIsConnected('assistant');
|
|
177
|
-
const text = useMessage<string>('message', 'assistant');
|
|
178
|
-
|
|
179
|
-
useEffect(() => {
|
|
180
|
-
addConnection('assistant', {
|
|
181
|
-
url: '/api/stream',
|
|
182
|
-
connectionClose: { message: 'eos' },
|
|
183
|
-
});
|
|
184
|
-
|
|
185
|
-
return () => removeConnection('assistant');
|
|
186
|
-
}, [addConnection, removeConnection]);
|
|
187
|
-
|
|
188
|
-
return <div>{connected ? text ?? 'streaming...' : 'disconnected'}</div>;
|
|
189
|
-
}
|
|
190
|
-
```
|
|
191
|
-
|
|
192
152
|
Uploads store example:
|
|
193
153
|
|
|
194
|
-
```
|
|
154
|
+
```tsx
|
|
155
|
+
import { UploadArea } from '@apple-pie/slice';
|
|
195
156
|
import {
|
|
196
157
|
createUploadsWorker,
|
|
197
|
-
uploadsActions,
|
|
198
158
|
useUploads,
|
|
199
159
|
useUploadsActions,
|
|
160
|
+
useUploadsWorkerStatus,
|
|
200
161
|
} from '@apple-pie/slice/stores/uploads';
|
|
162
|
+
import { useEffect, useRef } from 'react';
|
|
201
163
|
|
|
202
|
-
|
|
164
|
+
function UploadsExample() {
|
|
165
|
+
const workerRef = useRef<Worker | null>(null);
|
|
166
|
+
const uploads = useUploads();
|
|
167
|
+
const workerStatus = useUploadsWorkerStatus();
|
|
168
|
+
const actions = useUploadsActions();
|
|
203
169
|
|
|
204
|
-
|
|
170
|
+
useEffect(() => {
|
|
171
|
+
if (workerRef.current) return;
|
|
172
|
+
workerRef.current = createUploadsWorker();
|
|
173
|
+
actions.initialize({ uploadURL: '/api/uploads' }, workerRef.current);
|
|
174
|
+
}, [actions]);
|
|
175
|
+
|
|
176
|
+
return (
|
|
177
|
+
<div>
|
|
178
|
+
<UploadArea
|
|
179
|
+
busy={workerStatus === 'busy'}
|
|
180
|
+
files={uploads.map((upload) => ({
|
|
181
|
+
id: upload.id,
|
|
182
|
+
file: upload.file,
|
|
183
|
+
progress: upload.progress,
|
|
184
|
+
error: upload.error,
|
|
185
|
+
}))}
|
|
186
|
+
onUpload={(files) => actions.push(files)}
|
|
187
|
+
showProgress={true}
|
|
188
|
+
title={'Upload files'}
|
|
189
|
+
message={'Drag and drop files here or click to upload'}
|
|
190
|
+
/>
|
|
191
|
+
|
|
192
|
+
<div>worker: {workerStatus}</div>
|
|
193
|
+
|
|
194
|
+
{uploads.map((upload) => (
|
|
195
|
+
<div key={upload.id}>
|
|
196
|
+
{upload.file.name} - {upload.status} - {upload.progress ?? 0}%
|
|
197
|
+
</div>
|
|
198
|
+
))}
|
|
199
|
+
</div>
|
|
200
|
+
);
|
|
201
|
+
}
|
|
205
202
|
```
|
|
206
203
|
|
|
207
204
|
For consuming browser apps using a built worker asset, pass an explicit worker URL from your bundler:
|
|
@@ -226,37 +223,10 @@ This worker URL pattern assumes modern frontend tooling such as Vite or similar
|
|
|
226
223
|
## Utilities
|
|
227
224
|
|
|
228
225
|
- Package utilities are published from `@apple-pie/slice/utils`
|
|
229
|
-
- Low-level utility objects such as `SSEConnection` are also published from `@apple-pie/slice/utils/objects`
|
|
226
|
+
- Low-level utility objects such as `SSEConnection` and `WSConnection` are also published from `@apple-pie/slice/utils/objects`
|
|
230
227
|
- Internal utility source lives under `src/utils/functions/*`
|
|
231
228
|
- Shared utility CSS modules live under `src/utils/styling/*`
|
|
232
229
|
|
|
233
|
-
Example:
|
|
234
|
-
|
|
235
|
-
```ts
|
|
236
|
-
import { addOpacity, copyToClipboard, tintFromColor } from '@apple-pie/slice/utils';
|
|
237
|
-
```
|
|
238
|
-
|
|
239
|
-
SSE utility example:
|
|
240
|
-
|
|
241
|
-
```ts
|
|
242
|
-
import { SSEConnection } from '@apple-pie/slice/utils/objects';
|
|
243
|
-
|
|
244
|
-
const connection = new SSEConnection({
|
|
245
|
-
url: '/api/events',
|
|
246
|
-
unifiedOnMessage: true,
|
|
247
|
-
connectionClose: { message: 'eos' },
|
|
248
|
-
onMessageCallback: (message) => {
|
|
249
|
-
if (message.type === 'message') {
|
|
250
|
-
console.log(message.data);
|
|
251
|
-
}
|
|
252
|
-
|
|
253
|
-
if (message.type === 'close') {
|
|
254
|
-
console.log('stream closed');
|
|
255
|
-
}
|
|
256
|
-
},
|
|
257
|
-
});
|
|
258
|
-
```
|
|
259
|
-
|
|
260
230
|
## Development
|
|
261
231
|
|
|
262
232
|
```bash
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
|
|
3
|
-
var tslib_es6 = require("./tslib.es6-C8dZW5nY.js"), jsxRuntime = require("react/jsx-runtime"), react = require("motion/react"), React = require("react"), Badge = require("./Badge-CY_DG6cD.js"), Dot = require("./Dot-_HCJ3qxd.js"), _types = require("./_types-C_zOsCbB.js"), ProgressIndicator = require("./ProgressIndicator-
|
|
3
|
+
var tslib_es6 = require("./tslib.es6-C8dZW5nY.js"), jsxRuntime = require("react/jsx-runtime"), react = require("motion/react"), React = require("react"), Badge = require("./Badge-CY_DG6cD.js"), Dot = require("./Dot-_HCJ3qxd.js"), _types = require("./_types-C_zOsCbB.js"), ProgressIndicator = require("./ProgressIndicator-DVD-gD3T.js"), sharedTypes = require("./sharedTypes-gCECyn2N.js"), styleInject_es = require("./style-inject.es-CMuL-BfJ.js"), css = {
|
|
4
4
|
button: "Button-module_button__2ZuB7 flexBox-module_row__z24tF",
|
|
5
5
|
label: "Button-module_label__UJ3Zt",
|
|
6
6
|
count: "Button-module_count__DFxVB flexBox-module_row__z24tF",
|
|
@@ -13,7 +13,7 @@ var tslib_es6 = require("./tslib.es6-C8dZW5nY.js"), jsxRuntime = require("react/
|
|
|
13
13
|
styleInject_es.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");
|
|
14
14
|
|
|
15
15
|
const ButtonComponent = React.forwardRef((props, buttonRef) => {
|
|
16
|
-
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 = "
|
|
16
|
+
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 = tslib_es6.__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 = tslib_es6.__rest(divAttributes, [ "id", "className", "style" ]), divStyle = null != style ? style : {}, divClass = className ? ` ${className}` : "", [btnState, setBtnState] = React.useState(state), [btnWidth, setBtnWidth] = React.useState(void 0), [playing, setPlaying] = React.useState(working), ref = React.useRef(null), handleClick = React.useCallback(e => {
|
|
17
17
|
onToolTip(null), "disabled" !== btnState && (progress && duration ? setPlaying(!0) : onClick(e));
|
|
18
18
|
}, [ onToolTip, btnState, progress, duration, onClick ]);
|
|
19
19
|
React.useEffect(() => setBtnState(state), [ state ]), React.useEffect(() => setPlaying(working), [ working ]),
|
|
@@ -153,6 +153,8 @@ const ButtonComponent = React.forwardRef((props, buttonRef) => {
|
|
|
153
153
|
maxHeight: sizingStyles[size].height,
|
|
154
154
|
minHeight: sizingStyles[size].height,
|
|
155
155
|
flex: "fill" === width ? 1 : "unset",
|
|
156
|
+
width: width && "fill" !== width ? width : "min-content",
|
|
157
|
+
maxWidth: width && "fill" !== width ? width : "min-content",
|
|
156
158
|
gap: sizingStyles[size].gap,
|
|
157
159
|
borderWidth: colorStyles[variant].border,
|
|
158
160
|
borderStyle: "solid",
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
|
|
3
|
-
var tslib_es6 = require("./tslib.es6-C8dZW5nY.js"), jsxRuntime = require("react/jsx-runtime"), React = require("react"), misc = require("./misc-C-M6KKsH.js"), FileIcon = require("./FileIcon-hYwcre20.js"), _types = require("./_types-C_zOsCbB.js"), ProgressIndicator = require("./ProgressIndicator-
|
|
3
|
+
var tslib_es6 = require("./tslib.es6-C8dZW5nY.js"), jsxRuntime = require("react/jsx-runtime"), React = require("react"), misc = require("./misc-C-M6KKsH.js"), FileIcon = require("./FileIcon-hYwcre20.js"), _types = require("./_types-C_zOsCbB.js"), ProgressIndicator = require("./ProgressIndicator-DVD-gD3T.js"), styleInject_es = require("./style-inject.es-CMuL-BfJ.js");
|
|
4
4
|
|
|
5
5
|
var css = {
|
|
6
6
|
wrapper: "FileList-module_wrapper__9-rrl flexBox-module_rowStart__4tcxS",
|
|
@@ -4,7 +4,7 @@ var jsxRuntime = require("react/jsx-runtime"), React = require("react"), hooks_u
|
|
|
4
4
|
|
|
5
5
|
require("../theme/colors.js"), require("../hooks/useWindow.js");
|
|
6
6
|
|
|
7
|
-
var
|
|
7
|
+
var _types = require("./_types-C_zOsCbB.js"), styleInject_es = require("./style-inject.es-CMuL-BfJ.js"), tslib_es6 = require("./tslib.es6-C8dZW5nY.js"), react = require("motion/react"), css$1_wrapper = "DoneCheck-module_wrapper__AlISD flexBox-module_row__z24tF", css$1_icon = "DoneCheck-module_icon__bKaFp flexBox-module_row__z24tF";
|
|
8
8
|
|
|
9
9
|
styleInject_es.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}\n\n.DoneCheck-module_wrapper__AlISD {\n\theight: var(--icon-height);\n\tmax-height: var(--icon-height);\n\twidth: var(--icon-width);\n\tmax-width: var(--icon-width);\n\toverflow: visible;\n}\n\n.DoneCheck-module_icon__bKaFp {\n\theight: var(--icon-height);\n\tmax-height: var(--icon-height);\n\twidth: var(--icon-width);\n\tmax-width: var(--icon-width);\n\tscale: var(--icon-scale);\n\ttransition: var(--icon-transition);\n}\n");
|
|
10
10
|
|
|
@@ -4,7 +4,7 @@ var jsxRuntime = require("react/jsx-runtime"), React = require("react"), hooks_u
|
|
|
4
4
|
|
|
5
5
|
require("../theme/colors.js"), require("../hooks/useWindow.js");
|
|
6
6
|
|
|
7
|
-
var Button = require("./Button-
|
|
7
|
+
var Button = require("./Button-krf4dQeL.js"), styleInject_es = require("./style-inject.es-CMuL-BfJ.js"), FileList = require("./FileList-CkpMj-os.js"), css = {
|
|
8
8
|
wrapperBg: "PromptInput-module_wrapperBg__zabZq flexBox-module_columnStart__C7P44",
|
|
9
9
|
bgRotate: "PromptInput-module_bgRotate__Um720",
|
|
10
10
|
textareaWrapper: "PromptInput-module_textareaWrapper__KusiV flexBox-module_columnStart__C7P44",
|
|
@@ -0,0 +1,140 @@
|
|
|
1
|
+
"use strict";
|
|
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
|
+
};
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
|
|
3
|
-
var tslib_es6 = require("./tslib.es6-C8dZW5nY.js"), jsxRuntime = require("react/jsx-runtime"), React = require("react"), Button = require("./Button-
|
|
3
|
+
var tslib_es6 = require("./tslib.es6-C8dZW5nY.js"), jsxRuntime = require("react/jsx-runtime"), React = require("react"), Button = require("./Button-krf4dQeL.js"), styleInject_es = require("./style-inject.es-CMuL-BfJ.js"), css_wrapper = "TextArea-module_wrapper__O0sWP flexBox-module_columnStart__C7P44", css_textarea = "TextArea-module_textarea__-R2n0", css_send = "TextArea-module_send__Cub13", css_s = "TextArea-module_s__Ac-fq type-module_body-s-regular__vRHSP", css_m = "TextArea-module_m__dod4R type-module_body-m-regular__LuQBA", css_l = "TextArea-module_l__-uLCG type-module_body-l-regular__lOYbg";
|
|
4
4
|
|
|
5
5
|
styleInject_es.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.TextArea-module_wrapper__O0sWP {\n\tposition: relative;\n\tpadding: var(--ta-padding) !important;\n\twidth: var(--ta-width);\n\theight: auto;\n\tborder-radius: var(--ta-border-radius);\n\tbackground-color: var(--ta-bg-color);\n\tbox-shadow: 0 0 0 1px var(--ta-border-color);\n\ttransition: all var(--motion-water-duration) var(--motion-water) 0s;\n}\n\n.TextArea-module_textarea__-R2n0 {\n\tborder: 0;\n\toutline: 0;\n\tpadding: 0 16px 0 0;\n\twidth: 100%;\n\theight: 100%;\n\tcolor: var(--core-text-primary);\n\tbackground-color: transparent;\n\tbox-sizing: border-box;\n\tresize: var(--ta-resize);\n\n\t&:disabled {\n\t\tcolor: var(--core-text-disabled);\n\t}\n\n\t&::placeholder {\n\t\tcolor: var(--core-text-disabled);\n\t}\n\n\toverflow-y: auto;\n\n\t&::-webkit-scrollbar {\n\t\tbackground-color: transparent;\n\t\twidth: 14px;\n\t}\n\n\t&::-webkit-scrollbar-track {\n\t\tbackground-color: transparent;\n\t}\n\n\t&::-webkit-scrollbar-thumb {\n\t\tbackground-color: var(--scroll-bar);\n\t\tborder-radius: 20px;\n\t\tborder: 4px solid var(--core-surface-primary);\n\t}\n\n\t&::-webkit-scrollbar-thumb:hover {\n\t\tbackground-color: var(--scroll-bar);\n\t\tborder-radius: 20px;\n\t\tborder: 4px solid var(--core-surface-primary);\n\t\tcursor: default;\n\t}\n}\n\n.TextArea-module_actions__yunQx {\n\twidth: 100%;\n\tmin-height: 30px;\n\tcolor: var(--core-text-disabled);\n\tgap: 16px;\n}\n\n.TextArea-module_option__2SFx5 {\n\tgap: 4px;\n\twhite-space: nowrap;\n\tuser-select: none;\n\t-webkit-user-select: none;\n\tcursor: default;\n}\n\n.TextArea-module_send__Cub13 {\n\tposition: absolute;\n\tbottom: var(--ta-send-icon-offset-bottom);\n\tright: var(--ta-send-icon-offset-right);\n}\n\n.TextArea-module_s__Ac-fq {\n}\n\n.TextArea-module_m__dod4R {\n}\n\n.TextArea-module_l__-uLCG {\n}\n");
|
|
6
6
|
|
|
@@ -4,7 +4,7 @@ var tslib_es6 = require("./tslib.es6-C8dZW5nY.js"), jsxRuntime = require("react/
|
|
|
4
4
|
|
|
5
5
|
require("../theme/colors.js"), require("../hooks/useWindow.js");
|
|
6
6
|
|
|
7
|
-
var Button = require("./Button-
|
|
7
|
+
var Button = require("./Button-krf4dQeL.js"), _types = require("./_types-C_zOsCbB.js"), IconButton = require("./IconButton-CBWmUZxR.js"), styleInject_es = require("./style-inject.es-CMuL-BfJ.js"), css = {
|
|
8
8
|
wrapper: "TextField-module_wrapper__qZ-p- flexBox-module_rowStart__4tcxS",
|
|
9
9
|
container: "TextField-module_container__5U9yK flexBox-module_rowStart__4tcxS",
|
|
10
10
|
label: "TextField-module_label__jD8MR flexBox-module_rowStart__4tcxS",
|
|
@@ -50,7 +50,7 @@ const MOTION_CONFIG = {
|
|
|
50
50
|
error: "var(--feedback-warning)",
|
|
51
51
|
placeholder: "var(--core-text-disabled)",
|
|
52
52
|
disabled: "var(--core-text-disabled)",
|
|
53
|
-
label: "var(--core-text-
|
|
53
|
+
label: "var(--core-text-primary)"
|
|
54
54
|
}, iconLeft: iconLeft = null, clearButton: clearButton = {
|
|
55
55
|
size: 20
|
|
56
56
|
}, clearBlurs: clearBlurs = !1, disabled: disabled = !1, inputType: inputType = "text"} = props, divAttributes = tslib_es6.__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 = tslib_es6.__rest(divAttributes, [ "id", "className", "style" ]), divStyle = null != style ? style : {}, divClass = className ? ` ${className}` : "", input = React.useRef(null), [text, setText] = React.useState(value), [isFocused, setIsFocused] = React.useState(focused), [valid, setValid] = React.useState(isValid), [show, setShow] = React.useState(!1);
|
|
@@ -69,17 +69,19 @@ const MOTION_CONFIG = {
|
|
|
69
69
|
(null == input ? void 0 : input.current) && (clearBlurs || input.current.focus(),
|
|
70
70
|
setText(""), textIsValid("")), onChange(""), onClear();
|
|
71
71
|
}, [ clearBlurs, onChange, onClear, textIsValid ]), handleValueChange = React.useCallback(newValue => {
|
|
72
|
-
setText(newValue), onChange(newValue), valid || textIsValid(text);
|
|
73
|
-
}, [ onChange, textIsValid, text, valid ]), handleBlur = React.useCallback(() => {
|
|
74
|
-
textIsValid(text), setIsFocused(!1), onBlur(text);
|
|
75
|
-
}, [ text, onBlur, textIsValid ]), handleKeyDown = React.useCallback(e => {
|
|
72
|
+
disabled || (setText(newValue), onChange(newValue), valid || textIsValid(text));
|
|
73
|
+
}, [ onChange, textIsValid, text, valid, disabled ]), handleBlur = React.useCallback(() => {
|
|
74
|
+
disabled || (textIsValid(text), setIsFocused(!1), onBlur(text));
|
|
75
|
+
}, [ text, onBlur, textIsValid, disabled ]), handleKeyDown = React.useCallback(e => {
|
|
76
76
|
var _a;
|
|
77
|
-
if (
|
|
78
|
-
|
|
79
|
-
|
|
77
|
+
if (!disabled) {
|
|
78
|
+
if ("Enter" === e.key && (handleBlur(), onSubmit(text), null === (_a = input.current) || void 0 === _a || _a.blur()),
|
|
79
|
+
disabled) return e.preventDefault(), !0;
|
|
80
|
+
onKeydown(e.key, e);
|
|
81
|
+
}
|
|
80
82
|
}, [ text, disabled, onSubmit, onKeydown, handleBlur ]), handleFocus = React.useCallback(() => {
|
|
81
|
-
setIsFocused(!0), onFocus(text);
|
|
82
|
-
}, [ text, onFocus ]), toggleShow = React.useCallback(() => {
|
|
83
|
+
disabled || (setIsFocused(!0), onFocus(text));
|
|
84
|
+
}, [ text, onFocus, disabled ]), toggleShow = React.useCallback(() => {
|
|
83
85
|
setShow(prev => !prev);
|
|
84
86
|
}, []), iconContainerStyle = React.useMemo(() => iconLeft ? {
|
|
85
87
|
width: iconLeft.size,
|
|
@@ -97,7 +99,7 @@ const MOTION_CONFIG = {
|
|
|
97
99
|
var _a, _b, _c;
|
|
98
100
|
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)";
|
|
99
101
|
}, [ isFocused, valid, color, validate ]), setTextAlign = React.useMemo(() => null != textAlign ? textAlign : "left", [ textAlign ]), setShowOpacity = React.useMemo(() => "password" !== inputType ? "0" : isFocused ? "1" : "0.5", [ inputType, isFocused ]), cssVars = React.useMemo(() => {
|
|
100
|
-
var _a
|
|
102
|
+
var _a;
|
|
101
103
|
return {
|
|
102
104
|
"--tf-width": setStyleValue(size.width),
|
|
103
105
|
"--tf-height": setStyleValue(size.height),
|
|
@@ -107,12 +109,12 @@ const MOTION_CONFIG = {
|
|
|
107
109
|
"--tf-bg-color": setBackgroundColor,
|
|
108
110
|
"--tf-box-shadow": setBoxShadow,
|
|
109
111
|
"--tf-color": textColor,
|
|
110
|
-
"--tf-label-color":
|
|
112
|
+
"--tf-label-color": disabled ? "var(--core-text-disabled)" : color.label,
|
|
111
113
|
"--tf-text-align": setTextAlign,
|
|
112
114
|
"--tf-show-opacity": setShowOpacity,
|
|
113
|
-
"--tf-placeholder-color": null !== (
|
|
115
|
+
"--tf-placeholder-color": null !== (_a = color.placeholder) && void 0 !== _a ? _a : "var(--core-text-disabled)"
|
|
114
116
|
};
|
|
115
|
-
}, [ size, padding, label, borderRadius, setStyleValue, setBackgroundColor, setBoxShadow, textColor, setTextAlign, setShowOpacity, color ]);
|
|
117
|
+
}, [ size, padding, label, borderRadius, setStyleValue, setBackgroundColor, setBoxShadow, textColor, setTextAlign, setShowOpacity, color, disabled ]);
|
|
116
118
|
return jsxRuntime.jsxs("div", Object.assign({
|
|
117
119
|
id: divId,
|
|
118
120
|
className: `${css.wrapper}${divClass}`,
|
|
@@ -147,7 +149,7 @@ const MOTION_CONFIG = {
|
|
|
147
149
|
onFocus: handleFocus,
|
|
148
150
|
onBlur: handleBlur,
|
|
149
151
|
onMouseDown: e => e.stopPropagation(),
|
|
150
|
-
disabled: !editable,
|
|
152
|
+
disabled: !editable || disabled,
|
|
151
153
|
maxLength: maxLength
|
|
152
154
|
}), jsxRuntime.jsx(react.AnimatePresence, {
|
|
153
155
|
initial: !1,
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
|
|
3
|
-
var jsxRuntime = require("react/jsx-runtime"), React = require("react"), misc = require("./misc-C-M6KKsH.js"),
|
|
3
|
+
var jsxRuntime = require("react/jsx-runtime"), React = require("react"), misc = require("./misc-C-M6KKsH.js"), _types = require("./_types-C_zOsCbB.js"), ProgressIndicator = require("./ProgressIndicator-DVD-gD3T.js"), styleInject_es = require("./style-inject.es-CMuL-BfJ.js"), FileList = require("./FileList-CkpMj-os.js"), css = {
|
|
4
4
|
wrapper: "UploadArea-module_wrapper__aircC flexBox-module_column__ezvMq",
|
|
5
5
|
icon: "UploadArea-module_icon__M7n-m flexBox-module_row__z24tF",
|
|
6
6
|
title: "UploadArea-module_title__VbNGq type-module_body-l-bold__Fh2dt",
|