@access-ci/ui 0.9.0 → 0.10.0-beta1

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.
@@ -0,0 +1,272 @@
1
+ import { j as e, a as p, i as g, k as b, B as v } from "./index-lEG5SUtq.js";
2
+ import { I as h } from "./icon-B4ZiM0pS.js";
3
+ const C = {
4
+ "ACCESS Pegasus": "https://pegasus.isi.edu/wordpress/wp-content/uploads/2016/01/favicon.ico",
5
+ "ACCESS OnDemand": "https://openondemand.org/themes/fire/theme/assets/media/favicons/favicon.ico",
6
+ "Advance reservations": "calendar-check",
7
+ "Composable hardware fabric": "boxes",
8
+ "Compute Resources": "cpu-fill",
9
+ "CPU Compute": "cpu-fill",
10
+ "GPU Compute": "cpu",
11
+ "Innovative / Novel Compute": "lightbulb",
12
+ "Large Memory Nodes": "arrows-fullscreen",
13
+ Preemption: "clock-history",
14
+ "Science Gateway support": "globe",
15
+ "Service / Other": "stars",
16
+ "Storage Resources": "hdd-fill",
17
+ "Virtual Machines": "pc-display-horizontal",
18
+ Cloud: "cloud",
19
+ Storage: "hdd-fill"
20
+ };
21
+ function x({ active: t, tagCategory: o, tagId: c, iconUri: n, name: a, toggleTag: s }) {
22
+ const i = n || C[a] || "tag";
23
+ return /* @__PURE__ */ e.jsx(
24
+ "li",
25
+ {
26
+ className: `tag tag-category-${o.name.toLowerCase().replace(/[^a-z]+/g, "-")}${t.tagIds.has(c) ? " active" : ""}`,
27
+ children: /* @__PURE__ */ e.jsxs(
28
+ "button",
29
+ {
30
+ href: "#",
31
+ disabled: t.disabledTagIds.has(c),
32
+ onClick: (r) => {
33
+ r.preventDefault(), s(c);
34
+ },
35
+ children: [
36
+ i.startsWith("http") ? /* @__PURE__ */ e.jsx(h, { alt: a, src: i }) : /* @__PURE__ */ e.jsx(h, { name: i }),
37
+ a
38
+ ]
39
+ }
40
+ )
41
+ }
42
+ );
43
+ }
44
+ function f({ children: t }) {
45
+ return /* @__PURE__ */ e.jsx("ul", { className: "tags", children: t });
46
+ }
47
+ function N({
48
+ active: t,
49
+ baseUri: o,
50
+ description: c,
51
+ imageType: n,
52
+ imageUri: a,
53
+ name: s,
54
+ infoGroupId: i,
55
+ tags: r,
56
+ toggleTag: l
57
+ }) {
58
+ const u = `${o}/${i}`;
59
+ return /* @__PURE__ */ e.jsxs("div", { className: "resource-group", children: [
60
+ /* @__PURE__ */ e.jsx(
61
+ "a",
62
+ {
63
+ className: `resource-group-image image-type-${n}`,
64
+ href: u,
65
+ children: a ? /* @__PURE__ */ e.jsx("img", { src: a }) : /* @__PURE__ */ e.jsx(h, { name: "motherboard" })
66
+ }
67
+ ),
68
+ /* @__PURE__ */ e.jsxs("div", { className: "resource-group-text", children: [
69
+ /* @__PURE__ */ e.jsx("h3", { children: /* @__PURE__ */ e.jsx("a", { href: u, children: s }) }),
70
+ /* @__PURE__ */ e.jsx(f, { children: r.map((m) => /* @__PURE__ */ e.jsx(
71
+ x,
72
+ {
73
+ ...m,
74
+ active: t,
75
+ toggleTag: l
76
+ },
77
+ m.tagId
78
+ )) }),
79
+ /* @__PURE__ */ e.jsxs("p", { children: [
80
+ c && c,
81
+ /* @__PURE__ */ e.jsx("br", {}),
82
+ /* @__PURE__ */ e.jsxs("a", { href: u, children: [
83
+ "Learn more about ",
84
+ s,
85
+ " »"
86
+ ] })
87
+ ] })
88
+ ] })
89
+ ] });
90
+ }
91
+ function w({
92
+ active: t,
93
+ baseUri: o,
94
+ name: c,
95
+ resourceGroups: n,
96
+ toggleTag: a
97
+ }) {
98
+ return /* @__PURE__ */ e.jsxs(e.Fragment, { children: [
99
+ /* @__PURE__ */ e.jsx("h2", { children: c }),
100
+ n.filter(({ infoGroupId: s }) => t.infoGroupIds.has(s)).map((s) => /* @__PURE__ */ e.jsx(
101
+ N,
102
+ {
103
+ ...s,
104
+ baseUri: o,
105
+ active: t,
106
+ toggleTag: a
107
+ },
108
+ s.infoGroupId
109
+ ))
110
+ ] });
111
+ }
112
+ function y({
113
+ active: t,
114
+ clearTags: o,
115
+ tagCategories: c,
116
+ toggleTag: n
117
+ }) {
118
+ const [a, s] = p.useState(!1), i = p.useRef(null);
119
+ return p.useEffect(() => {
120
+ const r = () => s(!1);
121
+ return document.body.addEventListener("click", r), () => document.body.removeEventListener("click", r);
122
+ }, []), /* @__PURE__ */ e.jsxs(
123
+ "section",
124
+ {
125
+ className: "filters-outer",
126
+ onClick: (r) => {
127
+ r.stopPropagation();
128
+ },
129
+ children: [
130
+ /* @__PURE__ */ e.jsxs(
131
+ "button",
132
+ {
133
+ ref: i,
134
+ onClick: () => s(!a),
135
+ className: `btn-filters btn ${a ? "active" : ""}`,
136
+ children: [
137
+ /* @__PURE__ */ e.jsx(h, { name: "filter" }),
138
+ " Filters",
139
+ t.tagIds.size > 0 ? /* @__PURE__ */ e.jsx("span", { className: "active-tag-count", children: t.tagIds.size }) : null
140
+ ]
141
+ }
142
+ ),
143
+ a ? /* @__PURE__ */ e.jsxs("div", { className: "filters-inner", children: [
144
+ c.map((r) => /* @__PURE__ */ e.jsxs(e.Fragment, { children: [
145
+ /* @__PURE__ */ e.jsx("h2", { children: r.name }),
146
+ /* @__PURE__ */ e.jsx(f, { children: r.tags.map((l) => /* @__PURE__ */ e.jsx(x, { ...l, active: t, toggleTag: n })) })
147
+ ] })),
148
+ /* @__PURE__ */ e.jsxs(
149
+ "button",
150
+ {
151
+ onClick: o,
152
+ disabled: t.tagIds.size == 0,
153
+ className: "btn danger",
154
+ children: [
155
+ /* @__PURE__ */ e.jsx(h, { name: "trash" }),
156
+ " Clear Filters"
157
+ ]
158
+ }
159
+ )
160
+ ] }) : null
161
+ ]
162
+ }
163
+ );
164
+ }
165
+ function k({ setBotOpen: t }) {
166
+ const o = p.useRef(null), c = [
167
+ {
168
+ title: "Browse resources",
169
+ icon: "filter-square",
170
+ description: "Filter resources to find the best match for your research.",
171
+ onClick: (n) => {
172
+ n.preventDefault(), o.current && o.current.nextSibling.scrollIntoView({ bahavior: "smooth" });
173
+ }
174
+ },
175
+ {
176
+ title: "Ask a question",
177
+ icon: "question-circle",
178
+ onClick: (n) => {
179
+ n.preventDefault(), t(!0);
180
+ },
181
+ description: "You have resource questions. Our Q&A bot has answers!",
182
+ login: !0
183
+ },
184
+ {
185
+ title: "Get suggestions",
186
+ icon: "card-checklist",
187
+ href: "https://access-ara.ccs.uky.edu:8080/",
188
+ description: "Fill out a form to get resource recommendations."
189
+ },
190
+ {
191
+ title: "Read news",
192
+ icon: "newspaper",
193
+ href: "https://access-ci.org/tag/resource-providers/",
194
+ description: "See the latest news from resource providers."
195
+ }
196
+ ];
197
+ return /* @__PURE__ */ e.jsxs("section", { id: "resource-pathways", ref: o, children: [
198
+ /* @__PURE__ */ e.jsxs("p", { className: "intro", children: [
199
+ "ACCESS provides advanced computing resources ",
200
+ /* @__PURE__ */ e.jsx("strong", { children: "at no cost" }),
201
+ " ",
202
+ "to researchers and educators."
203
+ ] }),
204
+ /* @__PURE__ */ e.jsx("ul", { className: "resource-pathways", children: c.map(
205
+ ({ title: n, icon: a, href: s, description: i, login: r, onClick: l }, u) => /* @__PURE__ */ e.jsx("li", { className: `resource-pathway-${u}`, children: /* @__PURE__ */ e.jsxs("a", { href: s || "#", onClick: l, children: [
206
+ a ? /* @__PURE__ */ e.jsx(h, { name: a }) : null,
207
+ " ",
208
+ /* @__PURE__ */ e.jsxs("span", { className: "detail", children: [
209
+ /* @__PURE__ */ e.jsx("span", { className: "title", children: n }),
210
+ /* @__PURE__ */ e.jsx("span", { className: "description", children: i }),
211
+ r ? /* @__PURE__ */ e.jsxs("span", { className: "login", children: [
212
+ /* @__PURE__ */ e.jsx(h, { name: "key" }),
213
+ " Requires ACCESS Login"
214
+ ] }) : null
215
+ ] })
216
+ ] }) }, n)
217
+ ) })
218
+ ] });
219
+ }
220
+ function I({
221
+ baseUri: t,
222
+ title: o,
223
+ setBotOpen: c,
224
+ showBreadcrumbs: n = !0,
225
+ showTitle: a = !0
226
+ }) {
227
+ const [s, i] = p.useState([]), r = g(), l = p.useMemo(
228
+ () => r ? b(r, s) : null,
229
+ [r, s]
230
+ ), u = (d) => i(
231
+ s.includes(d) ? s.filter((j) => j != d) : [...s, d]
232
+ ), m = () => i([]);
233
+ return /* @__PURE__ */ e.jsxs(e.Fragment, { children: [
234
+ n && /* @__PURE__ */ e.jsx(
235
+ v,
236
+ {
237
+ expandWidth: !0,
238
+ items: [{ name: "Resources" }],
239
+ topBorder: !0
240
+ }
241
+ ),
242
+ o && /* @__PURE__ */ e.jsx("h1", { className: a ? "" : "visually-hidden", children: o }),
243
+ /* @__PURE__ */ e.jsx(k, { setBotOpen: c }),
244
+ /* @__PURE__ */ e.jsxs("div", { id: "browse-resources", children: [
245
+ l ? /* @__PURE__ */ e.jsx(
246
+ y,
247
+ {
248
+ tagCategories: r.tagCategories,
249
+ active: l,
250
+ clearTags: m,
251
+ toggleTag: u
252
+ }
253
+ ) : null,
254
+ r ? r.resourceCategories.filter(
255
+ ({ resourceCategoryId: d }) => l.resourceCategoryIds.has(d)
256
+ ).map((d) => /* @__PURE__ */ e.jsx(
257
+ w,
258
+ {
259
+ ...d,
260
+ active: l,
261
+ baseUri: t,
262
+ clearTags: m,
263
+ toggleTag: u
264
+ },
265
+ d.name
266
+ )) : null
267
+ ] })
268
+ ] });
269
+ }
270
+ export {
271
+ I as default
272
+ };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@access-ci/ui",
3
- "version": "0.9.0",
3
+ "version": "0.10.0-beta1",
4
4
  "description": "User interface components for ACCESS CI",
5
5
  "repository": "github:access-ci-org/access-ci-ui",
6
6
  "license": "Apache-2.0",
@@ -19,23 +19,29 @@
19
19
  "scripts": {
20
20
  "dev": "vite",
21
21
  "build": "vite build",
22
+ "lint": "eslint .",
22
23
  "preview": "vite preview"
23
24
  },
24
25
  "dependencies": {
25
26
  "@glidejs/glide": "^3.6.1",
26
- "@preact/compat": "^18.3.1",
27
- "@snf/access-qa-bot": "^2.4.2",
27
+ "@snf/access-qa-bot": "^2.6.0",
28
28
  "chart.js": "^4.4.6",
29
29
  "fuse.js": "^7.0.0",
30
- "preact": "^10.24.1",
31
- "preact-iso": "^2.6.3",
30
+ "react": "^18.1.0",
31
+ "react-dom": "^18.1.0",
32
+ "react-error-boundary": "^6.0.0",
33
+ "react-router": "^7.7.1",
32
34
  "tippy.js": "^6.3.7"
33
35
  },
34
36
  "devDependencies": {
35
- "@preact/preset-vite": "^2.9.1",
36
- "vite": "^5.4.8"
37
- },
38
- "eslintConfig": {
39
- "extends": "preact"
37
+ "@eslint/js": "^9.32.0",
38
+ "@types/react": "^18.0.0",
39
+ "@types/react-dom": "^18.0.0",
40
+ "@vitejs/plugin-react": "^4.7.0",
41
+ "eslint": "^9.32.0",
42
+ "eslint-plugin-react-hooks": "^5.2.0",
43
+ "eslint-plugin-react-refresh": "^0.4.20",
44
+ "globals": "^16.3.0",
45
+ "vite": "^7.0.6"
40
46
  }
41
47
  }