@kaushalparajuli/react-crud-ui 1.0.0 → 1.0.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.
package/dist/index.js CHANGED
@@ -2878,7 +2878,7 @@ const Yr = ie("X", [
2878
2878
  size: "default"
2879
2879
  }
2880
2880
  }
2881
- ), ue = l.forwardRef(
2881
+ ), ce = l.forwardRef(
2882
2882
  ({ className: e, variant: t, size: r, asChild: n = !1, loading: o = !1, children: s, disabled: i, ...a }, c) => /* @__PURE__ */ M(
2883
2883
  n ? Nd : "button",
2884
2884
  {
@@ -2893,7 +2893,7 @@ const Yr = ie("X", [
2893
2893
  }
2894
2894
  )
2895
2895
  );
2896
- ue.displayName = "Button";
2896
+ ce.displayName = "Button";
2897
2897
  const bt = l.forwardRef(({ className: e, ...t }, r) => /* @__PURE__ */ d(
2898
2898
  "div",
2899
2899
  {
@@ -12016,7 +12016,7 @@ const od = ({
12016
12016
  ] }),
12017
12017
  /* @__PURE__ */ M("div", { className: "flex items-center gap-1", children: [
12018
12018
  /* @__PURE__ */ M(
12019
- ue,
12019
+ ce,
12020
12020
  {
12021
12021
  variant: "outline",
12022
12022
  size: "icon",
@@ -12030,7 +12030,7 @@ const od = ({
12030
12030
  }
12031
12031
  ),
12032
12032
  /* @__PURE__ */ M(
12033
- ue,
12033
+ ce,
12034
12034
  {
12035
12035
  variant: "outline",
12036
12036
  size: "icon",
@@ -12044,7 +12044,7 @@ const od = ({
12044
12044
  }
12045
12045
  ),
12046
12046
  /* @__PURE__ */ d("div", { className: "flex items-center gap-1", children: v().map((h, y) => h === "..." ? /* @__PURE__ */ d("span", { className: "px-2 text-muted-foreground", children: "..." }, `ellipsis-${y}`) : /* @__PURE__ */ d(
12047
- ue,
12047
+ ce,
12048
12048
  {
12049
12049
  variant: e === h ? "default" : "outline",
12050
12050
  size: "icon",
@@ -12055,7 +12055,7 @@ const od = ({
12055
12055
  h
12056
12056
  )) }),
12057
12057
  /* @__PURE__ */ M(
12058
- ue,
12058
+ ce,
12059
12059
  {
12060
12060
  variant: "outline",
12061
12061
  size: "icon",
@@ -12069,7 +12069,7 @@ const od = ({
12069
12069
  }
12070
12070
  ),
12071
12071
  /* @__PURE__ */ M(
12072
- ue,
12072
+ ce,
12073
12073
  {
12074
12074
  variant: "outline",
12075
12075
  size: "icon",
@@ -12177,22 +12177,19 @@ const Dx = l.forwardRef(({
12177
12177
  disabled: n,
12178
12178
  className: o,
12179
12179
  ...s
12180
- }, i) => {
12181
- const a = require("../ui/button").Button;
12182
- return /* @__PURE__ */ d(
12183
- a,
12184
- {
12185
- ref: i,
12186
- disabled: n || e,
12187
- className: o,
12188
- ...s,
12189
- children: e ? /* @__PURE__ */ M(Re, { children: [
12190
- /* @__PURE__ */ d($t, { className: "mr-2 h-4 w-4 animate-spin" }),
12191
- t || "Loading..."
12192
- ] }) : r
12193
- }
12194
- );
12195
- });
12180
+ }, i) => /* @__PURE__ */ d(
12181
+ ce,
12182
+ {
12183
+ ref: i,
12184
+ disabled: n || e,
12185
+ className: o,
12186
+ ...s,
12187
+ children: e ? /* @__PURE__ */ M(Re, { children: [
12188
+ /* @__PURE__ */ d($t, { className: "mr-2 h-4 w-4 animate-spin" }),
12189
+ t || "Loading..."
12190
+ ] }) : r
12191
+ }
12192
+ ));
12196
12193
  Dx.displayName = "LoadingButton";
12197
12194
  const yr = ({
12198
12195
  icon: e = bs,
@@ -12239,7 +12236,7 @@ const yr = ({
12239
12236
  /* @__PURE__ */ d("h3", { className: "text-lg font-semibold mb-2", children: m }),
12240
12237
  /* @__PURE__ */ d("p", { className: "text-sm text-muted-foreground mb-6 max-w-sm", children: g }),
12241
12238
  c,
12242
- (n || s) && /* @__PURE__ */ d(ue, { onClick: s, children: o || "Take Action" })
12239
+ (n || s) && /* @__PURE__ */ d(ce, { onClick: s, children: o || "Take Action" })
12243
12240
  ]
12244
12241
  }
12245
12242
  );
@@ -12256,7 +12253,7 @@ const sd = ({
12256
12253
  title: `No results for "${e}"`,
12257
12254
  description: "Try searching with different keywords or check your filters.",
12258
12255
  className: r,
12259
- children: t && /* @__PURE__ */ d(ue, { variant: "outline", onClick: t, children: "Clear Search" })
12256
+ children: t && /* @__PURE__ */ d(ce, { variant: "outline", onClick: t, children: "Clear Search" })
12260
12257
  }
12261
12258
  );
12262
12259
  sd.displayName = "SearchEmptyState";
@@ -12347,11 +12344,11 @@ const id = ({
12347
12344
  size: "sm",
12348
12345
  className: p,
12349
12346
  footer: /* @__PURE__ */ M("div", { className: "flex gap-2 justify-end", children: [
12350
- /* @__PURE__ */ d(ue, { variant: "outline", onClick: () => {
12347
+ /* @__PURE__ */ d(ce, { variant: "outline", onClick: () => {
12351
12348
  n == null || n(), t == null || t(!1);
12352
12349
  }, disabled: u, children: a }),
12353
12350
  /* @__PURE__ */ d(
12354
- ue,
12351
+ ce,
12355
12352
  {
12356
12353
  variant: c === "destructive" ? "destructive" : "default",
12357
12354
  onClick: async () => {
@@ -12412,7 +12409,7 @@ const $x = ({
12412
12409
  /* @__PURE__ */ d("div", { className: "py-4", children: s }),
12413
12410
  /* @__PURE__ */ M(Ho, { children: [
12414
12411
  /* @__PURE__ */ d(
12415
- ue,
12412
+ ce,
12416
12413
  {
12417
12414
  type: "button",
12418
12415
  variant: "outline",
@@ -12421,7 +12418,7 @@ const $x = ({
12421
12418
  children: a
12422
12419
  }
12423
12420
  ),
12424
- /* @__PURE__ */ d(ue, { type: "submit", disabled: c, children: c ? "Saving..." : i })
12421
+ /* @__PURE__ */ d(ce, { type: "submit", disabled: c, children: c ? "Saving..." : i })
12425
12422
  ] })
12426
12423
  ] })
12427
12424
  }
@@ -12503,7 +12500,7 @@ const ad = ({
12503
12500
  if (!P || P.length === 0) return null;
12504
12501
  const Z = P.filter((G) => G.hidden ? typeof G.hidden == "function" ? !G.hidden(W) : !G.hidden : !0);
12505
12502
  return Z.length === 0 ? null : /* @__PURE__ */ M(Zw, { children: [
12506
- /* @__PURE__ */ d(Qw, { asChild: !0, children: /* @__PURE__ */ M(ue, { variant: "ghost", size: "icon", className: "h-8 w-8", children: [
12503
+ /* @__PURE__ */ d(Qw, { asChild: !0, children: /* @__PURE__ */ M(ce, { variant: "ghost", size: "icon", className: "h-8 w-8", children: [
12507
12504
  /* @__PURE__ */ d(Rf, { className: "h-4 w-4" }),
12508
12505
  /* @__PURE__ */ d("span", { className: "sr-only", children: "Open menu" })
12509
12506
  ] }) }),
@@ -12559,7 +12556,7 @@ const ad = ({
12559
12556
  S.length,
12560
12557
  " row(s) selected",
12561
12558
  /* @__PURE__ */ d(
12562
- ue,
12559
+ ce,
12563
12560
  {
12564
12561
  variant: "ghost",
12565
12562
  size: "sm",
@@ -12768,7 +12765,7 @@ const Lx = ({
12768
12765
  }
12769
12766
  }, Ye = () => ne ? /* @__PURE__ */ M("div", { className: "flex items-center gap-2", children: [
12770
12767
  y && b.length > 0 && L.length > 0 && /* @__PURE__ */ d(Re, { children: L.map((Ce, We) => /* @__PURE__ */ M(
12771
- ue,
12768
+ ce,
12772
12769
  {
12773
12770
  variant: Ce.variant || "outline",
12774
12771
  size: "sm",
@@ -12784,12 +12781,12 @@ const Lx = ({
12784
12781
  },
12785
12782
  Ce.label || We
12786
12783
  )) }),
12787
- $ && /* @__PURE__ */ M(ue, { variant: "outline", size: "sm", onClick: $, children: [
12784
+ $ && /* @__PURE__ */ M(ce, { variant: "outline", size: "sm", onClick: $, children: [
12788
12785
  /* @__PURE__ */ d(Nf, { className: "mr-2 h-4 w-4" }),
12789
12786
  Q
12790
12787
  ] }),
12791
12788
  _ && /* @__PURE__ */ M(
12792
- ue,
12789
+ ce,
12793
12790
  {
12794
12791
  variant: "outline",
12795
12792
  size: "sm",
@@ -12801,7 +12798,7 @@ const Lx = ({
12801
12798
  ]
12802
12799
  }
12803
12800
  ),
12804
- x && /* @__PURE__ */ M(ue, { size: "sm", onClick: x, children: [
12801
+ x && /* @__PURE__ */ M(ce, { size: "sm", onClick: x, children: [
12805
12802
  /* @__PURE__ */ d(Af, { className: "mr-2 h-4 w-4" }),
12806
12803
  B
12807
12804
  ] })
@@ -13362,12 +13359,12 @@ function sS(e = {}) {
13362
13359
  if (!t.disabled) {
13363
13360
  if (!A || K) {
13364
13361
  (p.isDirty || f.isDirty) && (ee = r.isDirty, r.isDirty = ae.isDirty = T(), F = ee !== ae.isDirty);
13365
- const ce = ft(X(o, C), N);
13366
- ee = !!X(r.dirtyFields, C), ce ? we(r.dirtyFields, C) : le(r.dirtyFields, C, !0), ae.dirtyFields = r.dirtyFields, F = F || (p.dirtyFields || f.dirtyFields) && ee !== !ce;
13362
+ const ue = ft(X(o, C), N);
13363
+ ee = !!X(r.dirtyFields, C), ue ? we(r.dirtyFields, C) : le(r.dirtyFields, C, !0), ae.dirtyFields = r.dirtyFields, F = F || (p.dirtyFields || f.dirtyFields) && ee !== !ue;
13367
13364
  }
13368
13365
  if (A) {
13369
- const ce = X(r.touchedFields, C);
13370
- ce || (le(r.touchedFields, C, A), ae.touchedFields = r.touchedFields, F = F || (p.touchedFields || f.touchedFields) && ce !== A);
13366
+ const ue = X(r.touchedFields, C);
13367
+ ue || (le(r.touchedFields, C, A), ae.touchedFields = r.touchedFields, F = F || (p.touchedFields || f.touchedFields) && ue !== A);
13371
13368
  }
13372
13369
  F && H && m.state.next(ae);
13373
13370
  }
@@ -13408,10 +13405,10 @@ function sS(e = {}) {
13408
13405
  if (H) {
13409
13406
  const { _f: F, ...ee } = H;
13410
13407
  if (F) {
13411
- const ae = a.array.has(F.name), ce = H._f && Zx(H._f);
13412
- ce && p.validatingFields && y([F.name], !0);
13408
+ const ae = a.array.has(F.name), ue = H._f && Zx(H._f);
13409
+ ue && p.validatingFields && y([F.name], !0);
13413
13410
  const Le = await li(H, a.disabled, s, g, t.shouldUseNativeValidation && !N, ae);
13414
- if (ce && p.validatingFields && y([F.name]), Le[F.name] && (A.valid = !1, N))
13411
+ if (ue && p.validatingFields && y([F.name]), Le[F.name] && (A.valid = !1, N))
13415
13412
  break;
13416
13413
  !N && (X(Le, F.name) ? ae ? nS(r.errors, Le, F.name) : le(r.errors, F.name, Le[F.name]) : we(r.errors, F.name));
13417
13414
  }
@@ -13464,11 +13461,11 @@ function sS(e = {}) {
13464
13461
  i.mount = !0;
13465
13462
  const N = C.target;
13466
13463
  let A = N.name, K = !0;
13467
- const H = X(n, A), F = (ce) => {
13468
- K = Number.isNaN(ce) || xt(ce) && isNaN(ce.getTime()) || ft(ce, X(s, A, ce));
13464
+ const H = X(n, A), F = (ue) => {
13465
+ K = Number.isNaN(ue) || xt(ue) && isNaN(ue.getTime()) || ft(ue, X(s, A, ue));
13469
13466
  }, ee = ni(t.mode), ae = ni(t.reValidateMode);
13470
13467
  if (H) {
13471
- let ce, Le;
13468
+ let ue, Le;
13472
13469
  const wr = N.type ? ri(H._f) : Fx(C), lt = C.type === Zs.BLUR || C.type === Zs.FOCUS_OUT, vd = !Qx(H._f) && !t.resolver && !X(r.errors, A) && !H._f.deps || tS(lt, X(r.touchedFields, A), r.isSubmitted, ae, ee), _n = si(A, a, lt);
13473
13470
  le(s, A, wr), lt ? (!N || !N.readOnly) && (H._f.onBlur && H._f.onBlur(C), c && c(0)) : H._f.onChange && H._f.onChange(C);
13474
13471
  const Pn = E(A, wr, lt), yd = !Ae(Pn) || _n;
@@ -13482,11 +13479,11 @@ function sS(e = {}) {
13482
13479
  const { errors: ds } = await _([A]);
13483
13480
  if (F(wr), K) {
13484
13481
  const bd = ii(r.errors, n, A), fs = ii(ds, n, bd.name || A);
13485
- ce = fs.error, A = fs.name, Le = Ae(ds);
13482
+ ue = fs.error, A = fs.name, Le = Ae(ds);
13486
13483
  }
13487
13484
  } else
13488
- y([A], !0), ce = (await li(H, a.disabled, s, g, t.shouldUseNativeValidation))[A], y([A]), F(wr), K && (ce ? Le = !1 : (p.isValid || f.isValid) && (Le = await k(n, !0)));
13489
- K && (H._f.deps && (!Array.isArray(H._f.deps) || H._f.deps.length > 0) && O(H._f.deps), P(A, Le, ce, Pn));
13485
+ y([A], !0), ue = (await li(H, a.disabled, s, g, t.shouldUseNativeValidation))[A], y([A]), F(wr), K && (ue ? Le = !1 : (p.isValid || f.isValid) && (Le = await k(n, !0)));
13486
+ K && (H._f.deps && (!Array.isArray(H._f.deps) || H._f.deps.length > 0) && O(H._f.deps), P(A, Le, ue, Pn));
13490
13487
  }
13491
13488
  }, I = (C, N) => {
13492
13489
  if (X(r.errors, N) && C.focus)
@@ -13522,9 +13519,9 @@ function sS(e = {}) {
13522
13519
  errors: C ? r.errors : {}
13523
13520
  });
13524
13521
  }, fe = (C, N, A) => {
13525
- const K = (X(n, C, { _f: {} })._f || {}).ref, H = X(r.errors, C) || {}, { ref: F, message: ee, type: ae, ...ce } = H;
13522
+ const K = (X(n, C, { _f: {} })._f || {}).ref, H = X(r.errors, C) || {}, { ref: F, message: ee, type: ae, ...ue } = H;
13526
13523
  le(r.errors, C, {
13527
- ...ce,
13524
+ ...ue,
13528
13525
  ...N,
13529
13526
  ref: K
13530
13527
  }), m.state.next({
@@ -13591,7 +13588,7 @@ function sS(e = {}) {
13591
13588
  if (H) {
13592
13589
  Z(C, N), A = X(n, C);
13593
13590
  const F = ge(H.value) && H.querySelectorAll && H.querySelectorAll("input,select,textarea")[0] || H, ee = Gx(F), ae = A._f.refs || [];
13594
- if (ee ? ae.find((ce) => ce === F) : F === A._f.ref)
13591
+ if (ee ? ae.find((ue) => ue === F) : F === A._f.ref)
13595
13592
  return;
13596
13593
  le(n, C, {
13597
13594
  _f: {
@@ -13667,9 +13664,9 @@ function sS(e = {}) {
13667
13664
  for (const ee of a.mount) {
13668
13665
  const ae = X(n, ee);
13669
13666
  if (ae && ae._f) {
13670
- const ce = Array.isArray(ae._f.refs) ? ae._f.refs[0] : ae._f.ref;
13671
- if (zr(ce)) {
13672
- const Le = ce.closest("form");
13667
+ const ue = Array.isArray(ae._f.refs) ? ae._f.refs[0] : ae._f.ref;
13668
+ if (zr(ue)) {
13669
+ const Le = ue.closest("form");
13673
13670
  if (Le) {
13674
13671
  Le.reset();
13675
13672
  break;
@@ -14101,7 +14098,7 @@ const dS = ({
14101
14098
  }) }),
14102
14099
  y && /* @__PURE__ */ M("div", { className: "flex items-center justify-end gap-2 mt-6 pt-4 border-t", children: [
14103
14100
  o && /* @__PURE__ */ M(
14104
- ue,
14101
+ ce,
14105
14102
  {
14106
14103
  type: "button",
14107
14104
  variant: "outline",
@@ -14114,7 +14111,7 @@ const dS = ({
14114
14111
  }
14115
14112
  ),
14116
14113
  /* @__PURE__ */ d(
14117
- ue,
14114
+ ce,
14118
14115
  {
14119
14116
  type: "submit",
14120
14117
  disabled: c || a,
@@ -14131,7 +14128,7 @@ const dS = ({
14131
14128
  ] });
14132
14129
  return h && (u || p || b) ? /* @__PURE__ */ M(bt, { className: w, ...x, children: [
14133
14130
  /* @__PURE__ */ d(qr, { children: /* @__PURE__ */ M("div", { className: "flex items-center gap-4", children: [
14134
- b && s && /* @__PURE__ */ d(ue, { variant: "ghost", size: "icon", onClick: s, children: /* @__PURE__ */ d(Pr, { className: "h-4 w-4" }) }),
14131
+ b && s && /* @__PURE__ */ d(ce, { variant: "ghost", size: "icon", onClick: s, children: /* @__PURE__ */ d(Pr, { className: "h-4 w-4" }) }),
14135
14132
  /* @__PURE__ */ M("div", { children: [
14136
14133
  u && /* @__PURE__ */ d(Xr, { children: u }),
14137
14134
  p && /* @__PURE__ */ d(Zr, { children: p })
@@ -14254,7 +14251,7 @@ const fS = ({
14254
14251
  if (r)
14255
14252
  return /* @__PURE__ */ d(bt, { className: y, children: /* @__PURE__ */ M(wt, { className: "py-12 text-center", children: [
14256
14253
  /* @__PURE__ */ d("p", { className: "text-destructive", children: r.message || "An error occurred" }),
14257
- o && /* @__PURE__ */ M(ue, { variant: "outline", onClick: o, className: "mt-4", children: [
14254
+ o && /* @__PURE__ */ M(ce, { variant: "outline", onClick: o, className: "mt-4", children: [
14258
14255
  /* @__PURE__ */ d(Pr, { className: "mr-2 h-4 w-4" }),
14259
14256
  f
14260
14257
  ] })
@@ -14266,7 +14263,7 @@ const fS = ({
14266
14263
  m,
14267
14264
  " found"
14268
14265
  ] }),
14269
- o && /* @__PURE__ */ M(ue, { variant: "outline", onClick: o, className: "mt-4", children: [
14266
+ o && /* @__PURE__ */ M(ce, { variant: "outline", onClick: o, className: "mt-4", children: [
14270
14267
  /* @__PURE__ */ d(Pr, { className: "mr-2 h-4 w-4" }),
14271
14268
  f
14272
14269
  ] })
@@ -14319,19 +14316,19 @@ const fS = ({
14319
14316
  /* @__PURE__ */ M(bt, { className: y, ...b, children: [
14320
14317
  g && /* @__PURE__ */ M(qr, { className: "flex flex-row items-center justify-between space-y-0 pb-4", children: [
14321
14318
  /* @__PURE__ */ M("div", { className: "flex items-center gap-4", children: [
14322
- o && /* @__PURE__ */ d(ue, { variant: "ghost", size: "icon", onClick: o, children: /* @__PURE__ */ d(Pr, { className: "h-4 w-4" }) }),
14319
+ o && /* @__PURE__ */ d(ce, { variant: "ghost", size: "icon", onClick: o, children: /* @__PURE__ */ d(Pr, { className: "h-4 w-4" }) }),
14323
14320
  /* @__PURE__ */ M("div", { children: [
14324
14321
  a && /* @__PURE__ */ d(Xr, { children: a }),
14325
14322
  c && /* @__PURE__ */ d(Zr, { children: c })
14326
14323
  ] })
14327
14324
  ] }),
14328
14325
  /* @__PURE__ */ M("div", { className: "flex items-center gap-2", children: [
14329
- s && /* @__PURE__ */ M(ue, { variant: "outline", onClick: () => s(e), children: [
14326
+ s && /* @__PURE__ */ M(ce, { variant: "outline", onClick: () => s(e), children: [
14330
14327
  /* @__PURE__ */ d(Ei, { className: "mr-2 h-4 w-4" }),
14331
14328
  u
14332
14329
  ] }),
14333
14330
  i && /* @__PURE__ */ M(
14334
- ue,
14331
+ ce,
14335
14332
  {
14336
14333
  variant: "destructive",
14337
14334
  onClick: () => x(!0),
@@ -14604,7 +14601,7 @@ export {
14604
14601
  zy as AvatarFallback,
14605
14602
  jy as AvatarImage,
14606
14603
  xr as Badge,
14607
- ue as Button,
14604
+ ce as Button,
14608
14605
  bt as Card,
14609
14606
  wt as CardContent,
14610
14607
  Zr as CardDescription,