@wso2/am-core-ui 0.0.3 → 0.0.5

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.
@@ -1,8 +1,8 @@
1
1
  import { jsx as r, jsxs as j } from "react/jsx-runtime";
2
- import { useCallback as z, useMemo as R, useEffect as F, useState as W } from "react";
3
- import { Alert as T, Box as S, Collapse as B, Button as A, Form as y, TextField as L, Stack as M, CircularProgress as G, Typography as O, Select as q, MenuItem as D } from "@wso2/oxygen-ui";
4
- import { useParams as V, useNavigate as _, generatePath as k } from "react-router-dom";
5
- import { o as H, s as w, w as $, x as J, h as K, C as Q, F as U, g as I, P as X } from "./index-B7G9HzWI.js";
2
+ import { useCallback as z, useMemo as A, useEffect as V, useState as F } from "react";
3
+ import { Alert as L, Box as S, Collapse as B, Button as T, Form as y, TextField as W, Stack as M, CircularProgress as G, Typography as O, Select as q, MenuItem as D } from "@wso2/oxygen-ui";
4
+ import { useParams as R, useNavigate as _, generatePath as k } from "react-router-dom";
5
+ import { bw as H, bV as w, cV as K, bu as $, cT as J, cK as Q, cv as U, ar as I, P as X } from "./index-VBOtbRXp.js";
6
6
  import { c as Y } from "react/compiler-runtime";
7
7
  import "@tanstack/react-query";
8
8
  import { Link as Z, PackagePlus as ee, FolderPlus as te } from "@wso2/oxygen-ui-icons-react";
@@ -24,16 +24,16 @@ const re = H({
24
24
  e[0] !== n ? (t = Object.values(n), e[0] = n, e[1] = t) : t = e[1];
25
25
  const o = t, m = o.length > 0;
26
26
  let a;
27
- e[2] !== o ? (a = /* @__PURE__ */ r(T, { severity: "error", children: o.map(ie) }), e[2] = o, e[3] = a) : a = e[3];
27
+ e[2] !== o ? (a = /* @__PURE__ */ r(L, { severity: "error", children: o.map(ie) }), e[2] = o, e[3] = a) : a = e[3];
28
28
  let u;
29
29
  e[4] !== m || e[5] !== a ? (u = /* @__PURE__ */ r(B, { in: m, timeout: "auto", unmountOnExit: !0, children: a }), e[4] = m, e[5] = a, e[6] = u) : u = e[6];
30
30
  let h;
31
- e[7] !== s ? (h = /* @__PURE__ */ r(A, { variant: "outlined", color: "primary", size: "medium", onClick: s, children: "Cancel" }), e[7] = s, e[8] = h) : h = e[8];
31
+ e[7] !== s ? (h = /* @__PURE__ */ r(T, { variant: "outlined", color: "primary", size: "medium", onClick: s, children: "Cancel" }), e[7] = s, e[8] = h) : h = e[8];
32
32
  let p;
33
33
  e[9] !== l ? (p = l ? /* @__PURE__ */ r(Z, { size: 16 }) : /* @__PURE__ */ r(ee, { size: 16 }), e[9] = l, e[10] = p) : p = e[10];
34
- const x = N || C, v = l ? "Register" : "Create";
34
+ const v = N || C, x = l ? "Register" : "Create";
35
35
  let f;
36
- e[11] !== c || e[12] !== p || e[13] !== x || e[14] !== v ? (f = /* @__PURE__ */ r(A, { variant: "contained", color: "primary", size: "medium", startIcon: p, onClick: c, disabled: x, children: v }), e[11] = c, e[12] = p, e[13] = x, e[14] = v, e[15] = f) : f = e[15];
36
+ e[11] !== c || e[12] !== p || e[13] !== v || e[14] !== x ? (f = /* @__PURE__ */ r(T, { variant: "contained", color: "primary", size: "medium", startIcon: p, onClick: c, disabled: v, children: x }), e[11] = c, e[12] = p, e[13] = v, e[14] = x, e[15] = f) : f = e[15];
37
37
  let b;
38
38
  e[16] !== f || e[17] !== h ? (b = /* @__PURE__ */ j(S, { display: "flex", flexDirection: "row", gap: 1, alignItems: "center", children: [
39
39
  h,
@@ -58,7 +58,7 @@ const ae = ({
58
58
  }) => {
59
59
  const {
60
60
  orgId: g
61
- } = V(), d = z((t, o) => {
61
+ } = R(), d = z((t, o) => {
62
62
  const m = {
63
63
  ...i,
64
64
  [t]: o
@@ -69,10 +69,10 @@ const ae = ({
69
69
  }, [i, e, c, N, s]), {
70
70
  mutate: P,
71
71
  isPending: C
72
- } = $({
72
+ } = K({
73
73
  orgName: g
74
- }), l = R(
75
- () => J.debounce((t) => {
74
+ }), l = A(
75
+ () => $.debounce((t) => {
76
76
  if (t.length < 3) {
77
77
  d("name", "");
78
78
  return;
@@ -98,9 +98,9 @@ const ae = ({
98
98
  // 500ms delay
99
99
  [P, e, c]
100
100
  );
101
- return F(() => () => {
101
+ return V(() => () => {
102
102
  l.cancel();
103
- }, [l]), F(() => {
103
+ }, [l]), V(() => {
104
104
  i.displayName && i.displayName.length >= 3 ? l(i.displayName) : (l.cancel(), e((t) => ({
105
105
  ...t,
106
106
  name: ""
@@ -108,18 +108,18 @@ const ae = ({
108
108
  }, [i.displayName, e, l]), /* @__PURE__ */ r(y.Stack, { spacing: 3, children: /* @__PURE__ */ j(y.Section, { children: [
109
109
  /* @__PURE__ */ r(y.Subheader, { children: "Project Details" }),
110
110
  /* @__PURE__ */ j(y.Stack, { spacing: 2, children: [
111
- /* @__PURE__ */ r(y.ElementWrapper, { label: "Name", name: "displayName", children: /* @__PURE__ */ r(L, { id: "displayName", value: i.displayName, onChange: (t) => d("displayName", t.target.value), placeholder: "e.g., Customer Support Platform", error: !!n.displayName, helperText: C ? /* @__PURE__ */ j(M, { direction: "row", alignItems: "center", gap: 1, children: [
111
+ /* @__PURE__ */ r(y.ElementWrapper, { label: "Name", name: "displayName", children: /* @__PURE__ */ r(W, { id: "displayName", value: i.displayName, onChange: (t) => d("displayName", t.target.value), placeholder: "e.g., Customer Support Platform", error: !!n.displayName, helperText: C ? /* @__PURE__ */ j(M, { direction: "row", alignItems: "center", gap: 1, children: [
112
112
  /* @__PURE__ */ r(G, { size: 12 }),
113
113
  /* @__PURE__ */ r(O, { variant: "caption", children: "Validating name..." })
114
114
  ] }) : n.displayName, fullWidth: !0 }) }),
115
- /* @__PURE__ */ r(y.ElementWrapper, { label: "Description (optional)", name: "description", children: /* @__PURE__ */ r(L, { id: "description", value: i.description, onChange: (t) => d("description", t.target.value), placeholder: "Short description of this project", multiline: !0, minRows: 2, maxRows: 6, error: !!n.description, helperText: n.description, fullWidth: !0 }) }),
115
+ /* @__PURE__ */ r(y.ElementWrapper, { label: "Description (optional)", name: "description", children: /* @__PURE__ */ r(W, { id: "description", value: i.description, onChange: (t) => d("description", t.target.value), placeholder: "Short description of this project", multiline: !0, minRows: 2, maxRows: 6, error: !!n.description, helperText: n.description, fullWidth: !0 }) }),
116
116
  /* @__PURE__ */ r(S, { display: "none", children: /* @__PURE__ */ r(y.ElementWrapper, { label: "Deployment Pipeline", name: "deploymentPipeline", children: /* @__PURE__ */ r(q, { id: "deploymentPipeline", value: i.deploymentPipeline, onChange: (t) => d("deploymentPipeline", t.target.value), error: !!n.deploymentPipeline, fullWidth: !0, children: /* @__PURE__ */ r(D, { value: "default", children: "default" }) }) }) })
117
117
  ] })
118
118
  ] }) });
119
119
  }, oe = () => {
120
120
  const i = _(), {
121
121
  orgId: e
122
- } = V(), [n, N] = W({
122
+ } = R(), [n, N] = F({
123
123
  name: "",
124
124
  displayName: "",
125
125
  description: "",
@@ -130,10 +130,10 @@ const ae = ({
130
130
  validateForm: g,
131
131
  clearErrors: d,
132
132
  setFieldError: P
133
- } = K(re), {
133
+ } = J(re), {
134
134
  checkDirty: C,
135
135
  resetDirty: l
136
- } = Q(n), t = R(() => ({
136
+ } = Q(n), t = A(() => ({
137
137
  orgName: e ?? "default"
138
138
  }), [e]), {
139
139
  mutate: o,
@@ -143,7 +143,7 @@ const ae = ({
143
143
  i(k(I.children.org.path, {
144
144
  orgId: e ?? ""
145
145
  }));
146
- }, [i, e]), [h, p] = W({}), x = z(() => {
146
+ }, [i, e]), [h, p] = F({}), v = z(() => {
147
147
  if (g(n))
148
148
  p({});
149
149
  else {
@@ -162,8 +162,8 @@ const ae = ({
162
162
  projectId: n.name
163
163
  }));
164
164
  },
165
- onError: (v) => {
166
- console.error("Failed to create project:", v);
165
+ onError: (x) => {
166
+ console.error("Failed to create project:", x);
167
167
  }
168
168
  });
169
169
  }, [n, g, o, i, t.orgName, l, d, s]);
@@ -171,10 +171,10 @@ const ae = ({
171
171
  orgId: e ?? ""
172
172
  }), backLabel: "Back to Organization", children: /* @__PURE__ */ j(S, { display: "flex", flexDirection: "column", gap: 2, children: [
173
173
  /* @__PURE__ */ r(ae, { formData: n, setFormData: N, errors: s, validateField: c, setFieldError: P, checkDirty: C }),
174
- !!a && /* @__PURE__ */ r(T, { severity: "error", sx: {
174
+ !!a && /* @__PURE__ */ r(L, { severity: "error", sx: {
175
175
  mt: 2
176
176
  }, children: a instanceof Error ? a.message : "Failed to create project" }),
177
- /* @__PURE__ */ r(ne, { lastSubmittedValidationErrors: h, isPending: m, onCancel: u, onSubmit: x, isNameEmpty: !n.name.trim(), mode: "deploy" })
177
+ /* @__PURE__ */ r(ne, { lastSubmittedValidationErrors: h, isPending: m, onCancel: u, onSubmit: v, isNameEmpty: !n.name.trim(), mode: "deploy" })
178
178
  ] }) });
179
179
  }, ge = {
180
180
  title: "Add New Project",