@epam/ai-dial-projects 1.3.0-dev.213 → 1.3.0-dev.223
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/components/ProjectCapacityMeter/ProjectCapacityMeter.d.ts +17 -0
- package/components/ProjectCapacityMeter/ProjectCapacityMeter.d.ts.map +1 -0
- package/components/ProjectCard/ProjectCard.d.ts +8 -8
- package/components/ProjectCard/ProjectCard.d.ts.map +1 -1
- package/components/ProjectCreateForm/ProjectCreateForm.d.ts +5 -0
- package/components/ProjectCreateForm/ProjectCreateForm.d.ts.map +1 -0
- package/components/Projects/Projects.d.ts.map +1 -1
- package/hooks/useFileDropSurface.d.ts +28 -0
- package/hooks/useFileDropSurface.d.ts.map +1 -0
- package/index.css +2 -2
- package/index.d.ts +6 -0
- package/index.d.ts.map +1 -1
- package/index.js +487 -126
- package/models/project-create-form-props.d.ts +156 -0
- package/models/project-create-form-props.d.ts.map +1 -0
- package/models/project-item.d.ts +4 -2
- package/models/project-item.d.ts.map +1 -1
- package/models/projects-props.d.ts +15 -15
- package/models/projects-props.d.ts.map +1 -1
- package/package.json +8 -4
- package/types/context-file-rejection.d.ts +14 -0
- package/types/context-file-rejection.d.ts.map +1 -0
- package/types/project-name-error.d.ts +12 -0
- package/types/project-name-error.d.ts.map +1 -0
- package/utils/context-files.d.ts +36 -0
- package/utils/context-files.d.ts.map +1 -0
- package/utils/project-name.d.ts +11 -0
- package/utils/project-name.d.ts.map +1 -0
package/index.js
CHANGED
|
@@ -1,172 +1,533 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import { ButtonAppearance as
|
|
3
|
-
import { IconArrowsSort as
|
|
4
|
-
import { useMemo as
|
|
5
|
-
import { jsx as
|
|
1
|
+
import { MARKDOWN_EDITOR_MAX_HEIGHT_CLASS_NAME as e, MARKDOWN_EDITOR_PREVIEW_LIST_CLASS_NAME as t, PROHIBITED_CONVERSATION_NAME_CHARS_RE as n, PanelEmptyState as r, RequestStatus as i, TextRefinementField as a, buildCssVars as o, getAttachmentTypeFromMime as s, inferMimeTypeFromPath as c, mergeClasses as l, useAvailableHeightCap as ee, useTextRefinement as u } from "@epam/ai-dial-chat-shared";
|
|
2
|
+
import { Button as d, ButtonAppearance as te, ButtonDropdown as ne, ButtonVariant as f, CardShell as p, DIAL_ICON_SIZE as m, DIAL_KIT_ICON_STROKE as h, ElementSize as g, ErrorText as _, FileDropzone as v, FolderPath as y, GhostButton as b, Highlight as x, Input as S, Label as re, MenuItemMark as ie, Search as ae, Spinner as oe, Textarea as C } from "@epam/ai-dial-ui-kit";
|
|
3
|
+
import { IconArrowNarrowLeft as se, IconArrowsSort as ce, IconPlus as le } from "@tabler/icons-react";
|
|
4
|
+
import { Suspense as ue, lazy as w, useCallback as T, useEffect as de, useId as E, useMemo as D, useRef as O, useState as k } from "react";
|
|
5
|
+
import { jsx as A, jsxs as j } from "react/jsx-runtime";
|
|
6
|
+
import { AttachmentCard as fe, FileDndOverlay as pe } from "@epam/ai-dial-attachment-input";
|
|
7
|
+
import { BuilderFormContainer as me } from "@epam/ai-dial-builder-form";
|
|
8
|
+
import { LazyMarkdownEditor as M } from "@epam/ai-dial-ui-kit/editors";
|
|
6
9
|
//#region src/types/projects-sort-key.ts
|
|
7
|
-
var
|
|
10
|
+
var N = /* @__PURE__ */ function(e) {
|
|
8
11
|
return e.Newest = "newest", e.Oldest = "oldest", e.NameAsc = "name-asc", e;
|
|
9
|
-
}({}),
|
|
12
|
+
}({}), he = (e, t) => {
|
|
10
13
|
let n = t.trim().toLocaleLowerCase();
|
|
11
14
|
return n ? e.filter((e) => e.name.toLocaleLowerCase().includes(n)) : e;
|
|
12
|
-
},
|
|
15
|
+
}, ge = (e, t, n) => {
|
|
13
16
|
let r = new Intl.Collator(n, {
|
|
14
17
|
sensitivity: "base",
|
|
15
18
|
numeric: !0
|
|
16
19
|
}), i = (e, t) => r.compare(e.name, t.name);
|
|
17
|
-
if (t ===
|
|
18
|
-
let a = t ===
|
|
20
|
+
if (t === N.NameAsc) return [...e].sort(i);
|
|
21
|
+
let a = t === N.Oldest ? 1 : -1;
|
|
19
22
|
return [...e].sort((e, t) => e.updatedAt == null && t.updatedAt == null ? i(e, t) : e.updatedAt == null ? 1 : t.updatedAt == null ? -1 : (e.updatedAt - t.updatedAt) * a || i(e, t));
|
|
20
|
-
},
|
|
21
|
-
card: "
|
|
22
|
-
title: "
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
},
|
|
26
|
-
className:
|
|
27
|
-
children:
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
23
|
+
}, P = {
|
|
24
|
+
card: "_card_1b611_1",
|
|
25
|
+
title: "_title_1b611_5",
|
|
26
|
+
footer: "_footer_1b611_9",
|
|
27
|
+
path: "_path_1b611_13"
|
|
28
|
+
}, F = (e, t) => [e, ...(t ?? "").split("/").filter((e) => e.length > 0)], I = ({ project: e, searchQuery: t, sourceLabel: n, folderPathLabel: r, titleClassName: i, pathLabelClassName: a, pathLeafClassName: o }) => /* @__PURE__ */ A("li", {
|
|
29
|
+
className: "flex min-w-0",
|
|
30
|
+
children: /* @__PURE__ */ j(p, {
|
|
31
|
+
"aria-label": e.name,
|
|
32
|
+
className: l("flex w-full min-w-0 flex-col gap-3", P.card),
|
|
33
|
+
children: [/* @__PURE__ */ A(x, {
|
|
34
|
+
text: e.name,
|
|
35
|
+
query: t,
|
|
36
|
+
maxLines: 1,
|
|
37
|
+
className: l("min-w-0", i, P.title)
|
|
38
|
+
}), /* @__PURE__ */ A(y, {
|
|
39
|
+
segments: F(n, e.parentPath),
|
|
40
|
+
ariaLabel: r,
|
|
41
|
+
labelClassName: l(a, P.path),
|
|
42
|
+
leafClassName: l(o, P.path),
|
|
43
|
+
className: l("mt-auto pt-3", P.footer)
|
|
41
44
|
})]
|
|
42
|
-
})
|
|
43
|
-
}),
|
|
45
|
+
})
|
|
46
|
+
}), L = {
|
|
44
47
|
container: "_container_4rer8_1",
|
|
45
48
|
subtitle: "_subtitle_4rer8_5",
|
|
46
49
|
sortButton: "_sortButton_4rer8_9"
|
|
47
|
-
},
|
|
48
|
-
let { colors:
|
|
49
|
-
"--pr-bg":
|
|
50
|
-
"--pr-subtitle-text":
|
|
51
|
-
"--pr-sort-text":
|
|
52
|
-
"--pr-card-bg":
|
|
53
|
-
"--pr-card-
|
|
54
|
-
"--pr-card-
|
|
55
|
-
"--pr-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
50
|
+
}, R = ({ projects: e, isLoading: t = !1, hasError: n = !1, incompleteSources: i = [], onRetry: a, onCreateProject: s, searchQuery: c, onSearchQueryChange: ee, sortKey: u, onSortKeyChange: p, labels: _, locale: v, styles: y }) => {
|
|
51
|
+
let { colors: x, typography: S } = y ?? {}, re = S?.titleClassName ?? "dial-h1-text", C = S?.subtitleClassName ?? "dial-body-text", se = S?.cardTitleClassName ?? "dial-body-semi-text", ue = S?.pathLabelClassName ?? "dial-tiny-text", w = S?.pathLeafClassName ?? "dial-tiny-semi-text", T = o({
|
|
52
|
+
"--pr-bg": x?.background,
|
|
53
|
+
"--pr-subtitle-text": x?.subtitleText,
|
|
54
|
+
"--pr-sort-text": x?.sortButtonText,
|
|
55
|
+
"--pr-card-bg": x?.cardBackground,
|
|
56
|
+
"--pr-card-title-text": x?.cardTitleText,
|
|
57
|
+
"--pr-card-divider": x?.cardDivider,
|
|
58
|
+
"--pr-path-text": x?.pathText
|
|
59
|
+
}), de = c.trim(), E = i.length > 0, O = E && e.length === 0, k = D(() => ge(he(e, c), u, v), [
|
|
60
|
+
e,
|
|
61
|
+
c,
|
|
59
62
|
u,
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
M
|
|
63
|
-
]), K = j.sortOptions.find((e) => e.value === O)?.label ?? j.sortLabel, q = h(() => j.sortOptions.map((e) => ({
|
|
63
|
+
v
|
|
64
|
+
]), fe = _.sortOptions.find((e) => e.value === u)?.label ?? _.sortLabel, pe = D(() => _.sortOptions.map((e) => ({
|
|
64
65
|
key: e.value,
|
|
65
66
|
label: e.label,
|
|
66
|
-
mark:
|
|
67
|
-
checked: e.value ===
|
|
68
|
-
onClick: () =>
|
|
67
|
+
mark: ie.Check,
|
|
68
|
+
checked: e.value === u,
|
|
69
|
+
onClick: () => p(e.value)
|
|
69
70
|
})), [
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
]),
|
|
74
|
-
|
|
75
|
-
},
|
|
76
|
-
if (!
|
|
77
|
-
},
|
|
71
|
+
_.sortOptions,
|
|
72
|
+
u,
|
|
73
|
+
p
|
|
74
|
+
]), me = (e) => {
|
|
75
|
+
ee(e ?? "");
|
|
76
|
+
}, M = () => {
|
|
77
|
+
if (!t) return n ? _.errorLabel : E ? _.incompleteLabel : e.length === 0 ? _.emptyStateLabel : k.length === 0 ? _.noResultsLabel : _.resultCountLabel(k.length);
|
|
78
|
+
}, N = () => s ? /* @__PURE__ */ A(d, {
|
|
79
|
+
label: _.createProjectLabel,
|
|
80
|
+
variant: f.Primary,
|
|
81
|
+
iconBefore: /* @__PURE__ */ A(le, {
|
|
82
|
+
size: m.SM,
|
|
83
|
+
stroke: h,
|
|
84
|
+
"aria-hidden": !0
|
|
85
|
+
}),
|
|
86
|
+
onClick: s,
|
|
87
|
+
className: "shrink-0"
|
|
88
|
+
}) : void 0, P = () => t ? /* @__PURE__ */ A(oe, {}) : n || O ? /* @__PURE__ */ j("div", {
|
|
78
89
|
className: "flex flex-col items-center gap-3",
|
|
79
|
-
children: [/* @__PURE__ */
|
|
80
|
-
className:
|
|
81
|
-
children:
|
|
82
|
-
}), /* @__PURE__ */
|
|
83
|
-
label:
|
|
84
|
-
onClick:
|
|
90
|
+
children: [/* @__PURE__ */ A("p", {
|
|
91
|
+
className: l(C, L.subtitle),
|
|
92
|
+
children: n ? _.errorLabel : _.incompleteLabel
|
|
93
|
+
}), /* @__PURE__ */ A(b, {
|
|
94
|
+
label: _.retryLabel,
|
|
95
|
+
onClick: a
|
|
85
96
|
})]
|
|
86
|
-
}) :
|
|
87
|
-
label:
|
|
88
|
-
description:
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
97
|
+
}) : e.length === 0 ? /* @__PURE__ */ A(r, {
|
|
98
|
+
label: _.emptyStateLabel,
|
|
99
|
+
description: _.emptyStateDescription,
|
|
100
|
+
action: N()
|
|
101
|
+
}) : k.length === 0 ? /* @__PURE__ */ A(r, { label: _.noResultsLabel }) : /* @__PURE__ */ A("ul", {
|
|
102
|
+
className: "m-0 grid w-full max-w-[1116px] min-w-0 list-none grid-cols-1 gap-5 p-0 desktop:grid-cols-3",
|
|
103
|
+
children: k.map((e) => /* @__PURE__ */ A(I, {
|
|
92
104
|
project: e,
|
|
93
|
-
searchQuery:
|
|
94
|
-
sourceLabel:
|
|
95
|
-
|
|
96
|
-
titleClassName:
|
|
97
|
-
|
|
98
|
-
|
|
105
|
+
searchQuery: de,
|
|
106
|
+
sourceLabel: _.sourceLabels[e.source],
|
|
107
|
+
folderPathLabel: _.folderPathLabel,
|
|
108
|
+
titleClassName: se,
|
|
109
|
+
pathLabelClassName: ue,
|
|
110
|
+
pathLeafClassName: w
|
|
99
111
|
}, e.id))
|
|
100
|
-
}),
|
|
101
|
-
return /* @__PURE__ */
|
|
102
|
-
style:
|
|
103
|
-
className:
|
|
112
|
+
}), F = t || n || k.length === 0;
|
|
113
|
+
return /* @__PURE__ */ j("div", {
|
|
114
|
+
style: T,
|
|
115
|
+
className: l("flex h-full w-full min-w-0 flex-col gap-4 overflow-y-auto px-4 py-4 desktop:gap-6 desktop:px-8", L.container),
|
|
104
116
|
children: [
|
|
105
|
-
/* @__PURE__ */
|
|
106
|
-
className: "min-w-0",
|
|
107
|
-
children: [/* @__PURE__ */
|
|
108
|
-
className:
|
|
109
|
-
children:
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
117
|
+
/* @__PURE__ */ j("div", {
|
|
118
|
+
className: "flex min-w-0 items-start justify-between gap-3",
|
|
119
|
+
children: [/* @__PURE__ */ j("div", {
|
|
120
|
+
className: "min-w-0",
|
|
121
|
+
children: [/* @__PURE__ */ A("h1", {
|
|
122
|
+
className: l("break-words", re),
|
|
123
|
+
children: _.title
|
|
124
|
+
}), /* @__PURE__ */ A("p", {
|
|
125
|
+
className: l("mt-1", C, L.subtitle),
|
|
126
|
+
children: _.subtitle
|
|
127
|
+
})]
|
|
128
|
+
}), N()]
|
|
114
129
|
}),
|
|
115
|
-
/* @__PURE__ */
|
|
130
|
+
/* @__PURE__ */ j("div", {
|
|
116
131
|
className: "flex flex-col gap-3 desktop:flex-row desktop:items-center",
|
|
117
|
-
children: [/* @__PURE__ */
|
|
132
|
+
children: [/* @__PURE__ */ A("div", {
|
|
118
133
|
role: "search",
|
|
119
134
|
className: "min-w-0 flex-1",
|
|
120
|
-
children: /* @__PURE__ */
|
|
121
|
-
value:
|
|
122
|
-
onChange:
|
|
123
|
-
placeholder:
|
|
124
|
-
clearLabel:
|
|
125
|
-
"aria-label":
|
|
126
|
-
size:
|
|
135
|
+
children: /* @__PURE__ */ A(ae, {
|
|
136
|
+
value: c,
|
|
137
|
+
onChange: me,
|
|
138
|
+
placeholder: _.searchPlaceholder,
|
|
139
|
+
clearLabel: _.clearSearchLabel,
|
|
140
|
+
"aria-label": _.searchAriaLabel,
|
|
141
|
+
size: g.Large
|
|
127
142
|
})
|
|
128
|
-
}),
|
|
143
|
+
}), _.sortOptions.length > 0 && /* @__PURE__ */ A("div", {
|
|
129
144
|
role: "group",
|
|
130
|
-
"aria-label":
|
|
145
|
+
"aria-label": _.sortLabel,
|
|
131
146
|
className: "shrink-0",
|
|
132
|
-
children: /* @__PURE__ */
|
|
133
|
-
items:
|
|
134
|
-
label:
|
|
135
|
-
variant:
|
|
136
|
-
appearance:
|
|
137
|
-
iconBefore: /* @__PURE__ */
|
|
138
|
-
size:
|
|
147
|
+
children: /* @__PURE__ */ A(ne, {
|
|
148
|
+
items: pe,
|
|
149
|
+
label: fe,
|
|
150
|
+
variant: f.Primary,
|
|
151
|
+
appearance: te.Ghost,
|
|
152
|
+
iconBefore: /* @__PURE__ */ A(ce, {
|
|
153
|
+
size: m.SM,
|
|
139
154
|
"aria-hidden": !0,
|
|
140
|
-
stroke:
|
|
155
|
+
stroke: h
|
|
141
156
|
}),
|
|
142
|
-
className:
|
|
157
|
+
className: L.sortButton
|
|
143
158
|
})
|
|
144
159
|
})]
|
|
145
160
|
}),
|
|
146
|
-
/* @__PURE__ */
|
|
161
|
+
/* @__PURE__ */ A("span", {
|
|
147
162
|
role: "status",
|
|
148
163
|
"aria-live": "polite",
|
|
149
164
|
className: "sr-only",
|
|
150
|
-
children:
|
|
165
|
+
children: M()
|
|
151
166
|
}),
|
|
152
|
-
|
|
167
|
+
E && !t && !n && !O && /* @__PURE__ */ j("div", {
|
|
153
168
|
className: "flex flex-wrap items-center gap-3",
|
|
154
|
-
children: [/* @__PURE__ */
|
|
155
|
-
className:
|
|
156
|
-
children:
|
|
157
|
-
}), /* @__PURE__ */
|
|
158
|
-
label:
|
|
159
|
-
onClick:
|
|
169
|
+
children: [/* @__PURE__ */ A("p", {
|
|
170
|
+
className: l(C, L.subtitle),
|
|
171
|
+
children: _.incompleteLabel
|
|
172
|
+
}), /* @__PURE__ */ A(b, {
|
|
173
|
+
label: _.retryLabel,
|
|
174
|
+
onClick: a
|
|
160
175
|
})]
|
|
161
176
|
}),
|
|
162
|
-
/* @__PURE__ */
|
|
163
|
-
className:
|
|
164
|
-
children:
|
|
177
|
+
/* @__PURE__ */ A("div", {
|
|
178
|
+
className: l("flex w-full min-w-0 flex-1 flex-col", F && "items-center justify-center"),
|
|
179
|
+
children: P()
|
|
165
180
|
})
|
|
166
181
|
]
|
|
167
182
|
});
|
|
168
|
-
},
|
|
183
|
+
}, z = /* @__PURE__ */ function(e) {
|
|
169
184
|
return e.Personal = "personal", e.Shared = "shared", e.Organization = "organization", e;
|
|
170
|
-
}({})
|
|
185
|
+
}({}), B = (e) => !!e.dataTransfer?.types.includes("Files"), _e = (e) => {
|
|
186
|
+
let [t, n] = k(!1), r = O(0);
|
|
187
|
+
return {
|
|
188
|
+
isDragActive: t,
|
|
189
|
+
handlers: {
|
|
190
|
+
onDragEnter: T((e) => {
|
|
191
|
+
B(e) && (e.preventDefault(), r.current += 1, n(!0));
|
|
192
|
+
}, []),
|
|
193
|
+
onDragLeave: T((e) => {
|
|
194
|
+
B(e) && (--r.current, r.current <= 0 && (r.current = 0, n(!1)));
|
|
195
|
+
}, []),
|
|
196
|
+
onDragOver: T((e) => {
|
|
197
|
+
B(e) && e.preventDefault();
|
|
198
|
+
}, []),
|
|
199
|
+
onDrop: T((t) => {
|
|
200
|
+
if (!B(t)) return;
|
|
201
|
+
t.preventDefault(), r.current = 0, n(!1);
|
|
202
|
+
let i = Array.from(t.dataTransfer?.files ?? []);
|
|
203
|
+
i.length > 0 && e(i);
|
|
204
|
+
}, [e])
|
|
205
|
+
}
|
|
206
|
+
};
|
|
207
|
+
}, V = /* @__PURE__ */ function(e) {
|
|
208
|
+
return e.UnsupportedType = "unsupported-type", e.TooLarge = "too-large", e.CapacityExceeded = "capacity-exceeded", e.Duplicate = "duplicate", e.InvalidName = "invalid-name", e;
|
|
209
|
+
}({}), H = /* @__PURE__ */ function(e) {
|
|
210
|
+
return e.Required = "required", e.InvalidCharacters = "invalid-characters", e.Reserved = "reserved", e.TooLong = "too-long", e;
|
|
211
|
+
}({}), ve = 255, U = new RegExp(n.source, "u"), ye = /[\p{Cc}--]/u, be = /* @__PURE__ */ new Set([
|
|
212
|
+
".",
|
|
213
|
+
"..",
|
|
214
|
+
"v",
|
|
215
|
+
"files",
|
|
216
|
+
".dial-resource",
|
|
217
|
+
".dial-folder"
|
|
218
|
+
]), xe = (e) => new TextEncoder().encode(e).length, Se = (e) => {
|
|
219
|
+
let t = e.trim();
|
|
220
|
+
return t.length === 0 ? H.Required : xe(t) > 255 ? H.TooLong : U.test(t) || ye.test(t) ? H.InvalidCharacters : be.has(t) ? H.Reserved : null;
|
|
221
|
+
}, W = (e) => {
|
|
222
|
+
let t = e.lastIndexOf(".");
|
|
223
|
+
return t > 0 ? e.slice(t + 1).toLowerCase() : "";
|
|
224
|
+
}, Ce = (e) => e.reduce((e, t) => e + t.file.size, 0), G = 0, we = () => (G += 1, `project-context-${Date.now()}-${G}`), Te = (e) => {
|
|
225
|
+
let t = e.type || c(e.name) || "application/octet-stream";
|
|
226
|
+
return {
|
|
227
|
+
id: we(),
|
|
228
|
+
name: e.name,
|
|
229
|
+
contentType: t,
|
|
230
|
+
type: s(t),
|
|
231
|
+
status: i.Idle,
|
|
232
|
+
file: e
|
|
233
|
+
};
|
|
234
|
+
}, K = (e, t, n, r) => Se(e.name) != null || e.name.trim() !== e.name ? V.InvalidName : r.allowedExtensions.includes(W(e.name)) ? t.has(e.name) ? V.Duplicate : e.size > r.maxFileBytes ? V.TooLarge : n + e.size > r.maxTotalBytes ? V.CapacityExceeded : null : V.UnsupportedType, Ee = (e, t, n) => {
|
|
235
|
+
let r = new Set(t.map((e) => e.name)), i = Ce(t), a = [], o = [];
|
|
236
|
+
for (let t of e) {
|
|
237
|
+
let e = K(t, r, i, n);
|
|
238
|
+
e == null ? (r.add(t.name), i += t.size, a.push(Te(t))) : o.push({
|
|
239
|
+
name: t.name,
|
|
240
|
+
reason: e
|
|
241
|
+
});
|
|
242
|
+
}
|
|
243
|
+
return {
|
|
244
|
+
accepted: a,
|
|
245
|
+
rejected: o
|
|
246
|
+
};
|
|
247
|
+
}, q = (e, t) => t <= 0 ? 100 : Math.min(100, Math.max(0, Math.round(e / t * 100))), J = {
|
|
248
|
+
track: "_track_15unh_1",
|
|
249
|
+
fill: "_fill_15unh_5",
|
|
250
|
+
text: "_text_15unh_9"
|
|
251
|
+
}, De = ({ usedBytes: e, maxBytes: t, ariaLabel: n, formatLabel: r, textClassName: i = "dial-tiny-text" }) => {
|
|
252
|
+
if (e <= 0) return null;
|
|
253
|
+
let a = q(e, t), o = r(a);
|
|
254
|
+
return /* @__PURE__ */ j("div", {
|
|
255
|
+
className: "flex flex-col gap-1",
|
|
256
|
+
children: [/* @__PURE__ */ A("div", {
|
|
257
|
+
role: "meter",
|
|
258
|
+
"aria-label": n,
|
|
259
|
+
"aria-valuemin": 0,
|
|
260
|
+
"aria-valuemax": t,
|
|
261
|
+
"aria-valuenow": Math.min(e, t),
|
|
262
|
+
"aria-valuetext": o,
|
|
263
|
+
className: l("h-1 w-full overflow-hidden rounded-full", J.track),
|
|
264
|
+
children: /* @__PURE__ */ A("div", {
|
|
265
|
+
className: l("h-full rounded-full", J.fill),
|
|
266
|
+
style: { width: `${a}%` }
|
|
267
|
+
})
|
|
268
|
+
}), /* @__PURE__ */ A("span", {
|
|
269
|
+
"aria-hidden": !0,
|
|
270
|
+
className: l(i, J.text),
|
|
271
|
+
children: o
|
|
272
|
+
})]
|
|
273
|
+
});
|
|
274
|
+
}, Oe = {
|
|
275
|
+
formColumn: "_formColumn_16edi_1",
|
|
276
|
+
helper: "_helper_16edi_10"
|
|
277
|
+
}, ke = w(async () => ({ default: (await M()).MarkdownEditor })), Ae = "device", je = "file-manager", Y = ({ values: n, errors: r, onFieldChange: i, contextFiles: s, onContextFilesChange: c, allowedExtensions: d, maxFileBytes: p, maxTotalBytes: g, onPickFromFileManager: y, onRefineDescription: b, onRefineInstructions: x, onBack: ie, onCancel: ae, onSubmit: ce, isSubmitting: w = !1, labels: M, markdownEditorTheme: N, className: he, styles: ge }) => {
|
|
278
|
+
let P = E(), F = E(), I = E(), L = E(), R = E(), z = O(null), B = O(null), V = ee(), [H, ve] = k(!1), [U, ye] = k([]), [be, xe] = k(""), W = O(void 0), G = T((e) => e ? async (t, n) => {
|
|
279
|
+
if (W.current && !W.current.aborted) throw new DOMException("Busy", "AbortError");
|
|
280
|
+
W.current = n;
|
|
281
|
+
try {
|
|
282
|
+
return await e(t, n);
|
|
283
|
+
} finally {
|
|
284
|
+
W.current === n && (W.current = void 0);
|
|
285
|
+
}
|
|
286
|
+
} : void 0, []), we = D(() => G(b), [G, b]), Te = D(() => G(x), [G, x]), K = u({
|
|
287
|
+
value: n.description,
|
|
288
|
+
onChange: (e) => i("description", e),
|
|
289
|
+
onRefine: we,
|
|
290
|
+
disabled: w
|
|
291
|
+
}), q = u({
|
|
292
|
+
value: n.instructions,
|
|
293
|
+
onChange: (e) => i("instructions", e),
|
|
294
|
+
onRefine: Te,
|
|
295
|
+
disabled: w
|
|
296
|
+
}), J = K.isPending || q.isPending, Y = Se(n.name), X = r.name ?? (H && Y != null ? M.nameErrors[Y] : void 0), Me = Y != null || w || J;
|
|
297
|
+
de(() => {
|
|
298
|
+
r.name && z.current?.focus();
|
|
299
|
+
}, [r.name]);
|
|
300
|
+
let Ne = D(() => Ce(s), [s]), Pe = D(() => d.map((e) => `.${e}`).join(","), [d]), Z = (e) => {
|
|
301
|
+
if (e.length === 0) return;
|
|
302
|
+
let { accepted: t, rejected: n } = Ee(e, s, {
|
|
303
|
+
allowedExtensions: d,
|
|
304
|
+
maxFileBytes: p,
|
|
305
|
+
maxTotalBytes: g
|
|
306
|
+
});
|
|
307
|
+
ye(n), t.length > 0 && c([...s, ...t]), xe([t.length > 0 ? M.filesAddedStatus(t.length) : "", ...n.map(({ name: e, reason: t }) => M.fileRejections[t](e))].filter(Boolean).join(" "));
|
|
308
|
+
}, { isDragActive: Fe, handlers: Ie } = _e(Z), Le = (e) => {
|
|
309
|
+
let t = s.find((t) => t.id === e);
|
|
310
|
+
c(s.filter((t) => t.id !== e)), ye([]), t && xe(M.fileRemovedStatus(t.name));
|
|
311
|
+
}, Re = (e) => {
|
|
312
|
+
Z(Array.from(e.target.files ?? [])), e.target.value = "";
|
|
313
|
+
}, ze = async () => {
|
|
314
|
+
if (y) try {
|
|
315
|
+
let e = await y();
|
|
316
|
+
e && Z(e);
|
|
317
|
+
} catch {}
|
|
318
|
+
}, Be = [{
|
|
319
|
+
key: Ae,
|
|
320
|
+
label: M.addFromDeviceLabel,
|
|
321
|
+
onClick: () => B.current?.click()
|
|
322
|
+
}, ...y ? [{
|
|
323
|
+
key: je,
|
|
324
|
+
label: M.addFromFileManagerLabel,
|
|
325
|
+
onClick: () => void ze()
|
|
326
|
+
}] : []], Ve = () => {
|
|
327
|
+
!Me && (!W.current || W.current.aborted) && ce();
|
|
328
|
+
}, { colors: Q, typography: He } = ge ?? {}, Ue = He?.titleClassName ?? "dial-h1-text", $ = He?.labelClassName ?? "dial-body-semi-text", We = He?.helperClassName ?? "dial-tiny-text", Ge = o({
|
|
329
|
+
"--pcf-helper-text": Q?.helperText,
|
|
330
|
+
"--pcf-meter-track": Q?.meterTrack,
|
|
331
|
+
"--pcf-meter-fill": Q?.meterFill
|
|
332
|
+
}), Ke = M.refinement, qe = r.context, Je = !!qe;
|
|
333
|
+
return /* @__PURE__ */ j("div", {
|
|
334
|
+
className: l("relative flex h-full min-h-0 w-full", he),
|
|
335
|
+
...Ie,
|
|
336
|
+
children: [
|
|
337
|
+
/* @__PURE__ */ A(pe, {
|
|
338
|
+
isVisible: Fe,
|
|
339
|
+
labels: {
|
|
340
|
+
title: M.dropOverlayTitle,
|
|
341
|
+
subtitle: M.dropOverlaySubtitle
|
|
342
|
+
}
|
|
343
|
+
}),
|
|
344
|
+
/* @__PURE__ */ A(me, {
|
|
345
|
+
labels: {
|
|
346
|
+
title: M.title,
|
|
347
|
+
backButtonLabel: M.backLabel,
|
|
348
|
+
cancelButtonLabel: M.cancelLabel,
|
|
349
|
+
submitButtonLabel: M.createLabel,
|
|
350
|
+
submittingLabel: M.submittingLabel ?? M.createLabel
|
|
351
|
+
},
|
|
352
|
+
onBack: ie,
|
|
353
|
+
onCancel: ae,
|
|
354
|
+
onSubmit: Ve,
|
|
355
|
+
isCancelDisabled: w,
|
|
356
|
+
isSubmitDisabled: Me,
|
|
357
|
+
isSubmitting: w,
|
|
358
|
+
backIcon: /* @__PURE__ */ A(se, {
|
|
359
|
+
size: m.LG,
|
|
360
|
+
stroke: h,
|
|
361
|
+
"aria-hidden": !0,
|
|
362
|
+
className: "rtl:scale-x-[-1]"
|
|
363
|
+
}),
|
|
364
|
+
styles: {
|
|
365
|
+
colors: { background: Q?.background },
|
|
366
|
+
header: {
|
|
367
|
+
colors: { borderColor: Q?.headerBorder },
|
|
368
|
+
typography: { fontClassName: Ue }
|
|
369
|
+
},
|
|
370
|
+
cssVars: Ge
|
|
371
|
+
},
|
|
372
|
+
children: /* @__PURE__ */ j("div", {
|
|
373
|
+
className: l("mx-auto flex w-full max-w-[996px] min-w-0 flex-col gap-5 py-6", Oe.formColumn),
|
|
374
|
+
children: [
|
|
375
|
+
/* @__PURE__ */ j("div", {
|
|
376
|
+
className: "flex flex-col gap-1",
|
|
377
|
+
children: [/* @__PURE__ */ A(S, {
|
|
378
|
+
id: P,
|
|
379
|
+
inputRef: z,
|
|
380
|
+
value: n.name,
|
|
381
|
+
onChange: (e) => i("name", e ?? ""),
|
|
382
|
+
onBlur: () => ve(!0),
|
|
383
|
+
placeholder: M.namePlaceholder,
|
|
384
|
+
labelProps: {
|
|
385
|
+
label: M.nameLabel,
|
|
386
|
+
required: !0
|
|
387
|
+
},
|
|
388
|
+
required: !0,
|
|
389
|
+
"aria-required": !0,
|
|
390
|
+
invalid: !!X,
|
|
391
|
+
"aria-invalid": !!X,
|
|
392
|
+
"aria-describedby": X ? F : void 0
|
|
393
|
+
}), X && /* @__PURE__ */ A(_, {
|
|
394
|
+
id: F,
|
|
395
|
+
role: r.name ? "alert" : void 0,
|
|
396
|
+
className: We,
|
|
397
|
+
text: X
|
|
398
|
+
})]
|
|
399
|
+
}),
|
|
400
|
+
/* @__PURE__ */ A(a, {
|
|
401
|
+
isEnabled: !!b,
|
|
402
|
+
fieldId: I,
|
|
403
|
+
label: M.descriptionLabel,
|
|
404
|
+
labelClassName: $,
|
|
405
|
+
labels: Ke,
|
|
406
|
+
refinement: K,
|
|
407
|
+
disabled: w || J,
|
|
408
|
+
children: /* @__PURE__ */ A(C, {
|
|
409
|
+
id: I,
|
|
410
|
+
value: n.description,
|
|
411
|
+
onChange: (e) => {
|
|
412
|
+
K.reset(), i("description", e);
|
|
413
|
+
},
|
|
414
|
+
placeholder: M.descriptionPlaceholder,
|
|
415
|
+
labelProps: b ? void 0 : { label: M.descriptionLabel }
|
|
416
|
+
})
|
|
417
|
+
}),
|
|
418
|
+
/* @__PURE__ */ A(a, {
|
|
419
|
+
isEnabled: !!x,
|
|
420
|
+
fieldId: L,
|
|
421
|
+
label: M.instructionsLabel,
|
|
422
|
+
labelClassName: $,
|
|
423
|
+
labels: Ke,
|
|
424
|
+
refinement: q,
|
|
425
|
+
disabled: w || J,
|
|
426
|
+
children: /* @__PURE__ */ j("div", {
|
|
427
|
+
className: "flex flex-1 flex-col gap-1",
|
|
428
|
+
children: [!x && /* @__PURE__ */ A(re, {
|
|
429
|
+
htmlFor: L,
|
|
430
|
+
className: $,
|
|
431
|
+
label: M.instructionsLabel
|
|
432
|
+
}), /* @__PURE__ */ A("div", {
|
|
433
|
+
ref: V,
|
|
434
|
+
className: l("w-full", e, t),
|
|
435
|
+
children: /* @__PURE__ */ A(ue, {
|
|
436
|
+
fallback: /* @__PURE__ */ A(oe, {}),
|
|
437
|
+
children: /* @__PURE__ */ A(ke, {
|
|
438
|
+
id: L,
|
|
439
|
+
value: n.instructions,
|
|
440
|
+
onChange: (e) => {
|
|
441
|
+
q.reset(), i("instructions", e);
|
|
442
|
+
},
|
|
443
|
+
height: 360,
|
|
444
|
+
theme: N,
|
|
445
|
+
placeholder: M.instructionsPlaceholder
|
|
446
|
+
})
|
|
447
|
+
})
|
|
448
|
+
})]
|
|
449
|
+
})
|
|
450
|
+
}),
|
|
451
|
+
/* @__PURE__ */ j("section", {
|
|
452
|
+
"aria-labelledby": R,
|
|
453
|
+
className: "flex flex-col gap-3",
|
|
454
|
+
children: [
|
|
455
|
+
/* @__PURE__ */ j("div", {
|
|
456
|
+
className: "flex min-w-0 items-center justify-between gap-2",
|
|
457
|
+
children: [/* @__PURE__ */ A("h2", {
|
|
458
|
+
id: R,
|
|
459
|
+
className: $,
|
|
460
|
+
children: M.contextLabel
|
|
461
|
+
}), /* @__PURE__ */ A(ne, {
|
|
462
|
+
items: Be,
|
|
463
|
+
label: M.addLabel,
|
|
464
|
+
variant: f.Primary,
|
|
465
|
+
appearance: te.Ghost,
|
|
466
|
+
disabled: w,
|
|
467
|
+
iconBefore: /* @__PURE__ */ A(le, {
|
|
468
|
+
size: m.SM,
|
|
469
|
+
stroke: h,
|
|
470
|
+
"aria-hidden": !0
|
|
471
|
+
})
|
|
472
|
+
})]
|
|
473
|
+
}),
|
|
474
|
+
/* @__PURE__ */ A("input", {
|
|
475
|
+
ref: B,
|
|
476
|
+
type: "file",
|
|
477
|
+
multiple: !0,
|
|
478
|
+
accept: Pe,
|
|
479
|
+
tabIndex: -1,
|
|
480
|
+
"aria-hidden": !0,
|
|
481
|
+
className: "sr-only",
|
|
482
|
+
onChange: Re
|
|
483
|
+
}),
|
|
484
|
+
/* @__PURE__ */ A(v, {
|
|
485
|
+
label: M.dropZoneLabel,
|
|
486
|
+
description: M.dropZoneHint,
|
|
487
|
+
accept: Pe,
|
|
488
|
+
multiple: !0,
|
|
489
|
+
disabled: w,
|
|
490
|
+
onChange: Z,
|
|
491
|
+
onReject: Z
|
|
492
|
+
}),
|
|
493
|
+
(U.length > 0 || Je) && /* @__PURE__ */ j("ul", {
|
|
494
|
+
className: l("flex flex-col gap-1", We, Oe.helper),
|
|
495
|
+
children: [U.map(({ name: e, reason: t }) => /* @__PURE__ */ A("li", { children: M.fileRejections[t](e) }, `${t}:${e}`)), Je && /* @__PURE__ */ A("li", {
|
|
496
|
+
role: "alert",
|
|
497
|
+
children: qe
|
|
498
|
+
})]
|
|
499
|
+
}),
|
|
500
|
+
s.length > 0 && /* @__PURE__ */ A("ul", {
|
|
501
|
+
className: "flex min-w-0 flex-wrap gap-2",
|
|
502
|
+
children: s.map((e) => /* @__PURE__ */ A("li", {
|
|
503
|
+
className: "min-w-0",
|
|
504
|
+
children: /* @__PURE__ */ A(fe, {
|
|
505
|
+
attachment: e,
|
|
506
|
+
onRemove: Le,
|
|
507
|
+
labels: { removeLabel: M.removeFileLabel(e.name) }
|
|
508
|
+
})
|
|
509
|
+
}, e.id))
|
|
510
|
+
}),
|
|
511
|
+
/* @__PURE__ */ A(De, {
|
|
512
|
+
usedBytes: Ne,
|
|
513
|
+
maxBytes: g,
|
|
514
|
+
ariaLabel: M.capacityMeterLabel,
|
|
515
|
+
formatLabel: M.capacityLabel,
|
|
516
|
+
textClassName: We
|
|
517
|
+
})
|
|
518
|
+
]
|
|
519
|
+
})
|
|
520
|
+
]
|
|
521
|
+
})
|
|
522
|
+
}),
|
|
523
|
+
/* @__PURE__ */ A("span", {
|
|
524
|
+
role: "status",
|
|
525
|
+
"aria-live": "polite",
|
|
526
|
+
className: "sr-only",
|
|
527
|
+
children: w ? M.creatingStatus : be
|
|
528
|
+
})
|
|
529
|
+
]
|
|
530
|
+
});
|
|
531
|
+
};
|
|
171
532
|
//#endregion
|
|
172
|
-
export {
|
|
533
|
+
export { V as ContextFileRejection, ve as PROJECT_NAME_MAX_BYTES, Y as ProjectCreateForm, H as ProjectNameError, z as ProjectSource, R as Projects, N as ProjectsSortKey, Ee as checkContextFiles, Ce as getContextFilesSize, Se as validateProjectName };
|