@access-ci/ui 0.5.0-beta2 → 0.5.0

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,248 @@
1
+ import { u as e, c as p, h as f, A as g, _ as C, i as w, T as y, j as S, B as k } from "./index-mrRDD7GP.js";
2
+ import { I as d } from "./icon-6r8UmHaL.js";
3
+ const R = {
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 m({ active: r, tagCategory: i, tagId: c, iconUri: a, name: s, toggleTag: n }) {
22
+ const t = a || R[s] || "tag";
23
+ return /* @__PURE__ */ e(
24
+ "li",
25
+ {
26
+ class: `tag tag-category-${i.name.toLowerCase().replace(/[^a-z]+/g, "-")}${r.tagIds.has(c) ? " active" : ""}`,
27
+ children: /* @__PURE__ */ e(
28
+ "button",
29
+ {
30
+ href: "#",
31
+ disabled: r.disabledTagIds.has(c),
32
+ onClick: (o) => {
33
+ o.preventDefault(), n(c);
34
+ },
35
+ children: [
36
+ t.startsWith("http") ? /* @__PURE__ */ e(d, { alt: s, src: t }) : /* @__PURE__ */ e(d, { name: t }),
37
+ s
38
+ ]
39
+ }
40
+ )
41
+ }
42
+ );
43
+ }
44
+ function b({ children: r }) {
45
+ return /* @__PURE__ */ e("ul", { class: "tags", children: r });
46
+ }
47
+ function I({
48
+ active: r,
49
+ baseUri: i,
50
+ description: c,
51
+ imageType: a,
52
+ imageUri: s,
53
+ name: n,
54
+ infoGroupId: t,
55
+ tags: o,
56
+ toggleTag: u
57
+ }) {
58
+ const h = `${i}/${t}`;
59
+ return /* @__PURE__ */ e("div", { class: "resource-group", children: [
60
+ /* @__PURE__ */ e(
61
+ "a",
62
+ {
63
+ class: `resource-group-image image-type-${a}`,
64
+ href: h,
65
+ children: s ? /* @__PURE__ */ e("img", { src: s }) : /* @__PURE__ */ e(d, { name: "motherboard" })
66
+ }
67
+ ),
68
+ /* @__PURE__ */ e("div", { class: "resource-group-text", children: [
69
+ /* @__PURE__ */ e("h3", { children: /* @__PURE__ */ e("a", { href: h, children: n }) }),
70
+ /* @__PURE__ */ e(b, { children: o.map((l) => /* @__PURE__ */ e(m, { ...l, active: r, toggleTag: u })) }),
71
+ /* @__PURE__ */ e("p", { children: [
72
+ c && c,
73
+ /* @__PURE__ */ e("br", {}),
74
+ /* @__PURE__ */ e("a", { href: h, children: [
75
+ "Learn more about ",
76
+ n,
77
+ " »"
78
+ ] })
79
+ ] })
80
+ ] })
81
+ ] });
82
+ }
83
+ function A({
84
+ active: r,
85
+ baseUri: i,
86
+ name: c,
87
+ resourceGroups: a,
88
+ toggleTag: s
89
+ }) {
90
+ return /* @__PURE__ */ e(p, { children: [
91
+ /* @__PURE__ */ e("h2", { children: c }),
92
+ a.filter(({ infoGroupId: n }) => r.infoGroupIds.has(n)).map((n) => /* @__PURE__ */ e(
93
+ I,
94
+ {
95
+ ...n,
96
+ baseUri: i,
97
+ active: r,
98
+ toggleTag: s
99
+ }
100
+ ))
101
+ ] });
102
+ }
103
+ function T({
104
+ active: r,
105
+ clearTags: i,
106
+ tagCategories: c,
107
+ toggleTag: a
108
+ }) {
109
+ const [s, n] = f(!1), t = g(null);
110
+ return C(() => {
111
+ t.current && (t.current.addEventListener("click", (o) => o.stopPropagation()), document.body.addEventListener("click", () => n(!1)));
112
+ }, [t.current]), /* @__PURE__ */ e("section", { class: "filters-outer", ref: t, children: [
113
+ /* @__PURE__ */ e(
114
+ "button",
115
+ {
116
+ onClick: () => n(!s),
117
+ class: `btn-filters btn ${s ? "active" : ""}`,
118
+ children: [
119
+ /* @__PURE__ */ e(d, { name: "filter" }),
120
+ " Filters",
121
+ r.tagIds.size > 0 ? /* @__PURE__ */ e("span", { class: "active-tag-count", children: r.tagIds.size }) : null
122
+ ]
123
+ }
124
+ ),
125
+ s ? /* @__PURE__ */ e("div", { class: "filters-inner", children: [
126
+ c.map((o) => /* @__PURE__ */ e(p, { children: [
127
+ /* @__PURE__ */ e("h2", { children: o.name }),
128
+ /* @__PURE__ */ e(b, { children: o.tags.map((u) => /* @__PURE__ */ e(m, { ...u, active: r, toggleTag: a })) })
129
+ ] })),
130
+ /* @__PURE__ */ e(
131
+ "button",
132
+ {
133
+ onClick: i,
134
+ disabled: r.tagIds.size == 0,
135
+ class: "btn danger",
136
+ children: [
137
+ /* @__PURE__ */ e(d, { name: "trash" }),
138
+ " Clear Filters"
139
+ ]
140
+ }
141
+ )
142
+ ] }) : null
143
+ ] });
144
+ }
145
+ function G() {
146
+ const r = g(null);
147
+ return /* @__PURE__ */ e("section", { id: "resource-pathways", ref: r, children: [
148
+ /* @__PURE__ */ e("p", { class: "intro", children: [
149
+ "ACCESS provides advanced computing resources ",
150
+ /* @__PURE__ */ e("strong", { children: "at no cost" }),
151
+ " ",
152
+ "to researchers and educators."
153
+ ] }),
154
+ /* @__PURE__ */ e("ul", { class: "resource-pathways", children: [
155
+ {
156
+ title: "Browse resources",
157
+ icon: "filter-square",
158
+ description: "Filter resources to find the best match for your research.",
159
+ onClick: (c) => {
160
+ c.preventDefault(), r.current && r.current.nextSibling.scrollIntoView({ bahavior: "smooth" });
161
+ }
162
+ },
163
+ {
164
+ title: "Ask a question",
165
+ icon: "question-circle",
166
+ href: "https://support.access-ci.org/",
167
+ description: "You have resource questions. Our Q&A bot has answers!",
168
+ login: !0
169
+ },
170
+ {
171
+ title: "Get suggestions",
172
+ icon: "card-checklist",
173
+ href: "https://access-ara.ccs.uky.edu:8080/",
174
+ description: "Fill out a form to get resource recommendations."
175
+ },
176
+ {
177
+ title: "Read news",
178
+ icon: "newspaper",
179
+ href: "https://access-ci.org/tag/resource-providers/",
180
+ description: "See the latest news from resource providers."
181
+ }
182
+ ].map(
183
+ ({ title: c, icon: a, href: s, description: n, login: t, onClick: o }, u) => /* @__PURE__ */ e("li", { class: `resource-pathway-${u}`, children: /* @__PURE__ */ e("a", { href: s || "#", onClick: o, children: [
184
+ a ? /* @__PURE__ */ e(d, { name: a }) : null,
185
+ " ",
186
+ /* @__PURE__ */ e("span", { class: "detail", children: [
187
+ /* @__PURE__ */ e("span", { class: "title", children: c }),
188
+ /* @__PURE__ */ e("span", { class: "description", children: n }),
189
+ t ? /* @__PURE__ */ e("span", { class: "login", children: [
190
+ /* @__PURE__ */ e(d, { name: "key" }),
191
+ " Requires ACCESS Login"
192
+ ] }) : null
193
+ ] })
194
+ ] }) })
195
+ ) })
196
+ ] });
197
+ }
198
+ function L({
199
+ baseUri: r,
200
+ title: i,
201
+ showBreadcrumbs: c = !0,
202
+ showTitle: a = !0
203
+ }) {
204
+ const [s, n] = f([]), t = w(), o = y(
205
+ () => t ? S(t, s) : null,
206
+ [t, s]
207
+ ), u = (l) => n(
208
+ s.includes(l) ? s.filter((v) => v != l) : [...s, l]
209
+ ), h = () => n([]);
210
+ return /* @__PURE__ */ e(p, { children: [
211
+ c && /* @__PURE__ */ e(
212
+ k,
213
+ {
214
+ expandWidth: !0,
215
+ items: [{ name: "Resources" }],
216
+ topBorder: !0
217
+ }
218
+ ),
219
+ i && /* @__PURE__ */ e("h1", { class: a ? "" : "visually-hidden", children: i }),
220
+ /* @__PURE__ */ e(G, {}),
221
+ /* @__PURE__ */ e("div", { id: "browse-resources", children: [
222
+ o ? /* @__PURE__ */ e(
223
+ T,
224
+ {
225
+ tagCategories: t.tagCategories,
226
+ active: o,
227
+ clearTags: h,
228
+ toggleTag: u
229
+ }
230
+ ) : null,
231
+ t ? t.resourceCategories.filter(
232
+ ({ resourceCategoryId: l }) => o.resourceCategoryIds.has(l)
233
+ ).map((l) => /* @__PURE__ */ e(
234
+ A,
235
+ {
236
+ ...l,
237
+ active: o,
238
+ baseUri: r,
239
+ clearTags: h,
240
+ toggleTag: u
241
+ }
242
+ )) : null
243
+ ] })
244
+ ] });
245
+ }
246
+ export {
247
+ L as default
248
+ };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@access-ci/ui",
3
- "version": "0.5.0-beta2",
3
+ "version": "0.5.0",
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",
@@ -1,227 +0,0 @@
1
- import { u as e, c as p, h as f, A as b, _ as w, a as C, i as v, T as y, j as k } from "./index-ClapqXAT.js";
2
- import { I as u } from "./icon-Bnee6DXz.js";
3
- const R = {
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
- "Storage Resources": "hdd-fill",
16
- "Virtual Machines": "pc-display-horizontal",
17
- Cloud: "cloud",
18
- Storage: "hdd-fill"
19
- };
20
- function g({ active: r, tagCategory: c, tagId: n, iconUri: t, name: a, toggleTag: s }) {
21
- const i = t || R[a] || "tag";
22
- return /* @__PURE__ */ e(
23
- "li",
24
- {
25
- class: `tag tag-category-${c.name.toLowerCase().replace(/[^a-z]+/g, "-")}${r.tagIds.has(n) ? " active" : ""}`,
26
- children: /* @__PURE__ */ e(
27
- "button",
28
- {
29
- href: "#",
30
- disabled: r.disabledTagIds.has(n),
31
- onClick: (o) => {
32
- o.preventDefault(), s(n);
33
- },
34
- children: [
35
- i.startsWith("http") ? /* @__PURE__ */ e(u, { alt: a, src: i }) : /* @__PURE__ */ e(u, { name: i }),
36
- a
37
- ]
38
- }
39
- )
40
- }
41
- );
42
- }
43
- function m({ children: r }) {
44
- return /* @__PURE__ */ e("ul", { class: "tags", children: r });
45
- }
46
- function I({
47
- active: r,
48
- baseUri: c,
49
- description: n,
50
- imageType: t,
51
- imageUri: a,
52
- name: s,
53
- infoGroupId: i,
54
- tags: o,
55
- toggleTag: d
56
- }) {
57
- const l = `${c}/${i}`;
58
- return /* @__PURE__ */ e("div", { class: "resource-group", children: [
59
- /* @__PURE__ */ e(
60
- "a",
61
- {
62
- class: `resource-group-image image-type-${t}`,
63
- href: l,
64
- children: a ? /* @__PURE__ */ e("img", { src: a }) : /* @__PURE__ */ e(u, { name: "motherboard" })
65
- }
66
- ),
67
- /* @__PURE__ */ e("div", { class: "resource-group-text", children: [
68
- /* @__PURE__ */ e("h3", { children: /* @__PURE__ */ e("a", { href: l, children: s }) }),
69
- /* @__PURE__ */ e(m, { children: o.map((h) => /* @__PURE__ */ e(g, { ...h, active: r, toggleTag: d })) }),
70
- /* @__PURE__ */ e("p", { children: [
71
- n && n,
72
- " ",
73
- /* @__PURE__ */ e("a", { href: l, children: [
74
- "Learn more about ",
75
- s,
76
- " »"
77
- ] })
78
- ] })
79
- ] })
80
- ] });
81
- }
82
- function S({
83
- active: r,
84
- baseUri: c,
85
- name: n,
86
- resourceGroups: t,
87
- toggleTag: a
88
- }) {
89
- return /* @__PURE__ */ e(p, { children: [
90
- /* @__PURE__ */ e("h2", { children: n }),
91
- t.filter(({ infoGroupId: s }) => r.infoGroupIds.has(s)).map((s) => /* @__PURE__ */ e(
92
- I,
93
- {
94
- ...s,
95
- baseUri: c,
96
- active: r,
97
- toggleTag: a
98
- }
99
- ))
100
- ] });
101
- }
102
- function A({
103
- active: r,
104
- clearTags: c,
105
- tagCategories: n,
106
- toggleTag: t
107
- }) {
108
- const [a, s] = f(!1), i = b(null);
109
- return w(() => {
110
- i.current && (i.current.addEventListener("click", (o) => o.stopPropagation()), document.body.addEventListener("click", () => s(!1)));
111
- }, [i.current]), /* @__PURE__ */ e("section", { class: "filters-outer", ref: i, children: [
112
- /* @__PURE__ */ e(
113
- "button",
114
- {
115
- onClick: () => s(!a),
116
- class: `btn-filters btn ${a ? "active" : ""}`,
117
- children: [
118
- /* @__PURE__ */ e(u, { name: "filter" }),
119
- " Filters",
120
- r.tagIds.size > 0 ? /* @__PURE__ */ e("span", { class: "active-tag-count", children: r.tagIds.size }) : null
121
- ]
122
- }
123
- ),
124
- a ? /* @__PURE__ */ e("div", { class: "filters-inner", children: [
125
- n.map((o) => /* @__PURE__ */ e(p, { children: [
126
- /* @__PURE__ */ e("h2", { children: o.name }),
127
- /* @__PURE__ */ e(m, { children: o.tags.map((d) => /* @__PURE__ */ e(g, { ...d, active: r, toggleTag: t })) })
128
- ] })),
129
- /* @__PURE__ */ e(
130
- "button",
131
- {
132
- onClick: c,
133
- disabled: r.tagIds.size == 0,
134
- class: "btn danger",
135
- children: [
136
- /* @__PURE__ */ e(u, { name: "trash" }),
137
- " Clear Filters"
138
- ]
139
- }
140
- )
141
- ] }) : null
142
- ] });
143
- }
144
- function T() {
145
- return /* @__PURE__ */ e("section", { id: "resource-pathways", children: /* @__PURE__ */ e("ul", { class: "resource-pathways", children: [
146
- {
147
- title: "Browse resources",
148
- icon: "filter-square",
149
- href: "#browse-resources",
150
- description: "Filter resources to find the best match for your research."
151
- },
152
- {
153
- title: "Ask a question",
154
- icon: "question-circle",
155
- href: "https://support.access-ci.org/",
156
- description: "You have resource questions. Our Q&A bot has answers!",
157
- login: !0
158
- },
159
- {
160
- title: "Get suggestions",
161
- icon: "card-checklist",
162
- href: "https://access-ara.ccs.uky.edu:8080/",
163
- description: "Fill out a form to get resource recommendations."
164
- }
165
- ].map(({ title: c, icon: n, href: t, description: a, login: s }, i) => /* @__PURE__ */ e("li", { class: `resource-pathway-${i}`, children: /* @__PURE__ */ e("a", { href: t, children: [
166
- n ? /* @__PURE__ */ e(u, { name: n }) : null,
167
- /* @__PURE__ */ e("span", { class: "detail", children: [
168
- /* @__PURE__ */ e("span", { class: "title", children: c }),
169
- /* @__PURE__ */ e("span", { class: "description", children: a }),
170
- s ? /* @__PURE__ */ e("span", { class: "login", children: [
171
- /* @__PURE__ */ e(u, { name: "key" }),
172
- " Requires ACCESS Login"
173
- ] }) : null
174
- ] })
175
- ] }) })) }) });
176
- }
177
- function G({ maxItems: r = 2 }) {
178
- const c = C("https://support.access-ci.org/access_news/api", {
179
- defaultValue: []
180
- });
181
- if (!(!c || c.error || !c.length))
182
- return /* @__PURE__ */ e("section", { id: "resource-news", children: [
183
- /* @__PURE__ */ e("h2", { children: "Resource News" }),
184
- /* @__PURE__ */ e("ul", { class: "resource-news", children: c.slice(0, r).map(({ title: n, linkUrl: t }) => /* @__PURE__ */ e("li", { children: /* @__PURE__ */ e("a", { href: t, class: "news-link", children: n.replace("&", "&").replace(" ", " ") }) })) })
185
- ] });
186
- }
187
- function P({ baseUri: r, title: c, showTitle: n }) {
188
- const [t, a] = f([]), s = v(), i = y(
189
- () => s ? k(s, t) : null,
190
- [s, t]
191
- ), o = (l) => a(
192
- t.includes(l) ? t.filter((h) => h != l) : [...t, l]
193
- ), d = () => a([]);
194
- return /* @__PURE__ */ e(p, { children: [
195
- c && /* @__PURE__ */ e("h1", { class: n ? "" : "visually-hidden", children: c }),
196
- /* @__PURE__ */ e("div", { id: "resource-navigation", children: [
197
- /* @__PURE__ */ e(T, {}),
198
- /* @__PURE__ */ e(G, {})
199
- ] }),
200
- /* @__PURE__ */ e("div", { id: "browse-resources", children: [
201
- i ? /* @__PURE__ */ e(
202
- A,
203
- {
204
- tagCategories: s.tagCategories,
205
- active: i,
206
- clearTags: d,
207
- toggleTag: o
208
- }
209
- ) : null,
210
- s ? s.resourceCategories.filter(
211
- ({ resourceCategoryId: l }) => i.resourceCategoryIds.has(l)
212
- ).map((l) => /* @__PURE__ */ e(
213
- S,
214
- {
215
- ...l,
216
- active: i,
217
- baseUri: r,
218
- clearTags: d,
219
- toggleTag: o
220
- }
221
- )) : null
222
- ] })
223
- ] });
224
- }
225
- export {
226
- P as default
227
- };