wafields 0.38.1 → 0.39.1

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.
@@ -48228,68 +48228,77 @@ function nP({ entries: e, onRemove: t }) {
48228
48228
  }
48229
48229
  //#endregion
48230
48230
  //#region src/common/inviteByEmails/InviteByEmails.tsx
48231
- function rP({ onInvite: e }) {
48232
- let [t, n] = y(!1), [r, i] = y(""), [a, o] = y(""), [s, c] = y([]), [l, u] = y(""), [d, f] = y(""), p = () => {
48233
- let e = r.trim();
48231
+ function rP({ onInvite: e, disabled: t, unsentEmails: n, errorMessage: r, className: i = "" }) {
48232
+ let [a, o] = y(!1), [s, c] = y(""), [l, u] = y(""), [d, f] = y([]), [p, h] = y(""), [g, _] = y(""), [v, C] = y(!1), w = () => {
48233
+ let e = s.trim();
48234
48234
  if (!Cn(e)) {
48235
- u("Invalid email address.");
48235
+ h("Invalid email address.");
48236
48236
  return;
48237
48237
  }
48238
- if (s.some((t) => t.email === e)) {
48239
- u("Email already added.");
48238
+ if (d.some((t) => t.email === e)) {
48239
+ h("Email already added.");
48240
48240
  return;
48241
48241
  }
48242
- c([...s, {
48242
+ f([...d, {
48243
48243
  email: e,
48244
- note: a.trim()
48245
- }]), i(""), o(""), u(""), f(`${e} added.`);
48246
- }, m = () => {
48247
- i(""), o(""), u(""), f("");
48248
- }, h = () => {
48249
- n(!1), m(), c([]);
48244
+ note: l.trim()
48245
+ }]), c(""), u(""), h(""), _(`${e} added.`);
48246
+ }, T = () => {
48247
+ c(""), u(""), h(""), _("");
48248
+ }, E = () => {
48249
+ o(!1), T(), f([]), C(!1);
48250
48250
  };
48251
- return /* @__PURE__ */ S(b, { children: [/* @__PURE__ */ x(oo, {
48251
+ return m(() => {
48252
+ !v || t || (n.length === 0 && !r ? E() : C(!1));
48253
+ }, [
48254
+ t,
48255
+ n,
48256
+ r,
48257
+ v
48258
+ ]), /* @__PURE__ */ S(b, { children: [/* @__PURE__ */ x(oo, {
48252
48259
  icon: {
48253
48260
  Svg: MN,
48254
48261
  className: "text-blue-500 fill-none"
48255
48262
  },
48256
48263
  label: "Invite Friends",
48257
- onClick: () => n(!0),
48258
- className: "border border-blue-500 w-fit px-2",
48264
+ onClick: () => o(!0),
48265
+ className: Ft("w-fit", i),
48259
48266
  labelClassName: "text-blue-500 text-sm whitespace-nowrap"
48260
48267
  }), /* @__PURE__ */ x(bo, {
48261
- isOpen: t,
48262
- onClose: h,
48268
+ isOpen: a,
48269
+ onClose: E,
48263
48270
  title: "Invite Friends",
48264
48271
  content: /* @__PURE__ */ S(ko, {
48265
48272
  className: "gap-3 w-full",
48266
48273
  children: [
48267
48274
  /* @__PURE__ */ x(eP, {
48268
- input: r,
48269
- noteInput: a,
48270
- error: l,
48271
- addedNote: d,
48275
+ input: s,
48276
+ noteInput: l,
48277
+ error: p,
48278
+ addedNote: g,
48272
48279
  onInputChange: (e) => {
48273
- i(e), u(""), f("");
48280
+ c(e), h(""), _("");
48274
48281
  },
48275
- onNoteChange: o,
48276
- onAdd: p,
48277
- onClear: m
48282
+ onNoteChange: u,
48283
+ onAdd: w,
48284
+ onClear: T
48278
48285
  }),
48279
48286
  /* @__PURE__ */ x(nP, {
48280
- entries: s,
48287
+ entries: d,
48281
48288
  onRemove: (e) => {
48282
- c(s.filter((t) => t.email !== e));
48289
+ f(d.filter((t) => t.email !== e));
48283
48290
  }
48284
48291
  }),
48292
+ n.length > 0 && /* @__PURE__ */ x(kD, { label: `Failed to send to: ${n.join(", ")}` }),
48293
+ r && /* @__PURE__ */ x(kD, { label: r }),
48285
48294
  /* @__PURE__ */ x(Lx, {}),
48286
48295
  /* @__PURE__ */ x(Co, {
48287
48296
  saveLabel: "Send Invitations",
48288
48297
  onSave: () => {
48289
- e(s), h();
48298
+ e(d), C(!0);
48290
48299
  },
48291
- onCancel: h,
48292
- isSaveDisabled: s.length === 0
48300
+ onCancel: E,
48301
+ isSaveDisabled: d.length === 0 || t
48293
48302
  })
48294
48303
  ]
48295
48304
  })
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "wafields",
3
- "version": "0.38.1",
3
+ "version": "0.39.1",
4
4
  "main": "dist/wafields.cjs.js",
5
5
  "module": "dist/wafields.es.js",
6
6
  "types": "dist/index.d.ts",