@orient-ai/aurora-ui 1.0.0-alpha.8 → 1.0.0-alpha.9

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
@@ -14272,58 +14272,60 @@ function Qh({ definition: e, filter: t, onChange: n }) {
14272
14272
  var $h = { form: "_form_1jnhx_1" };
14273
14273
  //#endregion
14274
14274
  //#region src/components/IndexTable/Toolbar/components/SaveView/SaveView.tsx
14275
- function eg({ view: e, onViewUpdate: t, onViewCreate: n }) {
14276
- let r = H(), i = l(), a = `${i}-name`, [o, s] = p(!1), [c, u] = p("");
14275
+ function eg({ selectedViewId: e, state: t, onViewUpdate: n, onViewCreate: r }) {
14276
+ let i = H(), a = l(), o = `${a}-name`, [s, c] = p(!1), [u, d] = p("");
14277
14277
  return /* @__PURE__ */ _(kh, {
14278
- open: o,
14279
- onOpenChange: s,
14278
+ open: s,
14279
+ onOpenChange: c,
14280
14280
  children: [/* @__PURE__ */ g(Ih, {
14281
- label: r("Save"),
14281
+ label: i("Save"),
14282
14282
  icon: "select",
14283
14283
  variant: "tertiary",
14284
14284
  actions: [{
14285
- content: r("Update view"),
14285
+ content: i("Update view"),
14286
14286
  icon: "refresh",
14287
- disabled: !t,
14288
- onAction: () => t?.(e)
14287
+ disabled: e === void 0 || !n,
14288
+ onAction: () => {
14289
+ e !== void 0 && n?.(e, t);
14290
+ }
14289
14291
  }, {
14290
- content: r("Save as new view"),
14292
+ content: i("Save as new view"),
14291
14293
  icon: "plus-circle",
14292
- disabled: !n,
14294
+ disabled: !r,
14293
14295
  onAction: () => {
14294
- u(""), s(!0);
14296
+ d(""), c(!0);
14295
14297
  }
14296
14298
  }]
14297
14299
  }), /* @__PURE__ */ g(Oh, {
14298
- heading: r("Save view as"),
14300
+ heading: i("Save view as"),
14299
14301
  primaryAction: /* @__PURE__ */ g(V, {
14300
14302
  variant: "primary",
14301
14303
  type: "submit",
14302
- form: i,
14303
- disabled: !c.trim() || !n,
14304
- children: r("Save")
14304
+ form: a,
14305
+ disabled: !u.trim() || !r,
14306
+ children: i("Save")
14305
14307
  }),
14306
14308
  secondaryActions: /* @__PURE__ */ g(jh, {
14307
14309
  render: /* @__PURE__ */ g(V, { variant: "secondary" }),
14308
- children: r("Discard")
14310
+ children: i("Discard")
14309
14311
  }),
14310
14312
  children: /* @__PURE__ */ _("form", {
14311
- id: i,
14313
+ id: a,
14312
14314
  className: $h.form,
14313
- onSubmit: (t) => {
14314
- t.preventDefault();
14315
- let r = c.trim();
14316
- r && n && (n(r, e), s(!1));
14315
+ onSubmit: (e) => {
14316
+ e.preventDefault();
14317
+ let n = u.trim();
14318
+ n && r && (r(n, t), c(!1));
14317
14319
  },
14318
14320
  children: [/* @__PURE__ */ g("label", {
14319
- htmlFor: a,
14320
- children: r("View name")
14321
+ htmlFor: o,
14322
+ children: i("View name")
14321
14323
  }), /* @__PURE__ */ g(Dm, {
14322
- id: a,
14324
+ id: o,
14323
14325
  autoFocus: !0,
14324
- value: c,
14326
+ value: u,
14325
14327
  maxLength: 40,
14326
- onChange: (e) => u(e.currentTarget.value)
14328
+ onChange: (e) => d(e.currentTarget.value)
14327
14329
  })]
14328
14330
  })
14329
14331
  })]
@@ -14471,103 +14473,49 @@ function ig({ columnDefinitions: e, columns: t, orderDefinitions: n, order: r, o
14471
14473
  }
14472
14474
  //#endregion
14473
14475
  //#region src/components/IndexTable/Toolbar/Toolbar.tsx
14474
- function ag({ views: e = [], state: t, onStateChange: n, columnDefinitions: r = [], orderDefinitions: i = [], filterDefinitions: a = [], onViewUpdate: o, onViewCreate: s, showFilter: c = !1, onShowFilterChange: l, ref: u, style: d }) {
14475
- let f = H(), h = ne(), v = {
14476
- duration: h ? 0 : .2,
14476
+ function ag({ views: e = [], selectedViewId: t, onViewChange: n, state: r, onStateChange: i, columnDefinitions: a = [], orderDefinitions: o = [], filterDefinitions: s = [], onViewUpdate: c, onViewCreate: l, showFilter: u = !1, onShowFilterChange: d, ref: f, style: p }) {
14477
+ let h = H(), v = ne(), y = {
14478
+ duration: v ? 0 : .2,
14477
14479
  ease: [
14478
14480
  .2,
14479
14481
  .8,
14480
14482
  0,
14481
14483
  1
14482
14484
  ]
14483
- }, [y, b] = p(() => {
14484
- let n = e.find((e) => e.id === t?.id) ?? e.at(0);
14485
- return {
14486
- savedView: n,
14487
- view: n ?? w()
14488
- };
14489
- }), x = t ?? y.view, S = e.find((e) => e.id === x.id) ?? e.at(0);
14490
- ae(y.savedView, S) || b({
14491
- savedView: S,
14492
- view: y.savedView?.id !== S?.id || ae(y.view, y.savedView) ? S ?? w() : {
14493
- ...y.view,
14494
- id: S?.id ?? y.view.id,
14495
- label: S?.label ?? y.view.label
14496
- }
14497
- });
14498
- let C = !(!S || ae([
14499
- x.query,
14500
- x.columns,
14501
- x.order,
14502
- x.filters
14503
- ], [
14504
- S.query,
14505
- S.columns,
14506
- S.order,
14507
- S.filters
14508
- ]));
14509
- function w() {
14510
- return {
14511
- id: "",
14512
- label: "",
14513
- query: "",
14514
- columns: r.map(({ id: e }) => ({
14515
- id: e,
14516
- hidden: !1
14517
- })),
14518
- order: {
14519
- id: i[0]?.id ?? "",
14520
- asc: !0
14521
- },
14522
- filters: []
14523
- };
14524
- }
14525
- function T(e) {
14526
- b({
14527
- savedView: S,
14528
- view: e
14529
- }), n?.(e);
14530
- }
14531
- function E(e, t) {
14532
- let n = x.filters.findIndex((t) => t.key === e), r = t ? n === -1 ? [...x.filters, t] : x.filters.map((e, r) => r === n ? t : e) : x.filters.filter((t) => t.key !== e);
14533
- T({
14534
- ...x,
14535
- filters: r
14485
+ }, b = e.find((e) => e.id === t), x = !(!b || ae(r, b.state)) || !b && !!l;
14486
+ function S(e, t) {
14487
+ let n = [...r.filters], a = n.findIndex((t) => t.key === e);
14488
+ t ? a === -1 ? n.push(t) : n[a] = t : a !== -1 && n.splice(a, 1), i({
14489
+ ...r,
14490
+ filters: n
14536
14491
  });
14537
14492
  }
14538
14493
  return /* @__PURE__ */ _("div", {
14539
- ref: u,
14494
+ ref: f,
14540
14495
  className: m("aurora-base", Zh.root),
14541
- style: d,
14496
+ style: p,
14542
14497
  children: [/* @__PURE__ */ _("div", {
14543
14498
  className: Zh.toolbar,
14544
- "data-has-view": !!S || void 0,
14499
+ "data-has-view": e.length > 0 || void 0,
14545
14500
  children: [
14546
- S && /* @__PURE__ */ g(Ih, {
14547
- label: S.label,
14501
+ e.length > 0 && /* @__PURE__ */ g(Ih, {
14502
+ label: b?.label ?? h("Select view"),
14548
14503
  variant: "tertiary",
14549
14504
  icon: "select",
14550
14505
  selectable: !0,
14551
- value: S.id,
14552
- onValueChange: (t) => {
14553
- if (t === S.id) return;
14554
- let r = e.find((e) => e.id === t);
14555
- r && (b({
14556
- savedView: r,
14557
- view: r
14558
- }), n?.(r));
14559
- },
14506
+ value: b?.id ?? null,
14507
+ onValueChange: n,
14560
14508
  actions: e.map((e) => ({
14561
14509
  id: e.id,
14562
14510
  content: e.label
14563
14511
  }))
14564
14512
  }),
14565
14513
  /* @__PURE__ */ g(Dm, {
14566
- placeholder: f("Search and filter"),
14514
+ placeholder: h("Search and filter"),
14567
14515
  prefix: /* @__PURE__ */ g(B, { type: "search" }),
14568
- value: x.query,
14569
- onChange: (e) => T({
14570
- ...x,
14516
+ value: r.query,
14517
+ onChange: (e) => i({
14518
+ ...r,
14571
14519
  query: e.currentTarget.value
14572
14520
  })
14573
14521
  }),
@@ -14576,37 +14524,37 @@ function ag({ views: e = [], state: t, onStateChange: n, columnDefinitions: r =
14576
14524
  gap: "small-500",
14577
14525
  children: [
14578
14526
  /* @__PURE__ */ g(ig, {
14579
- columnDefinitions: r,
14580
- columns: x.columns,
14581
- orderDefinitions: i,
14582
- order: x.order,
14583
- onColumnsChange: (e) => T({
14584
- ...x,
14527
+ columnDefinitions: a,
14528
+ columns: r.columns,
14529
+ orderDefinitions: o,
14530
+ order: r.order,
14531
+ onColumnsChange: (e) => i({
14532
+ ...r,
14585
14533
  columns: e
14586
14534
  }),
14587
- onOrderChange: (e) => T({
14588
- ...x,
14535
+ onOrderChange: (e) => i({
14536
+ ...r,
14589
14537
  order: e
14590
14538
  })
14591
- }, x.id),
14592
- a.length > 0 && /* @__PURE__ */ g(V, {
14539
+ }, t),
14540
+ s.length > 0 && /* @__PURE__ */ g(V, {
14593
14541
  variant: "tertiary",
14594
14542
  icon: "adjust",
14595
- "data-popup-open": c || void 0,
14596
- onClick: () => l(!c)
14543
+ "data-popup-open": u || void 0,
14544
+ onClick: () => d(!u)
14597
14545
  }),
14598
14546
  /* @__PURE__ */ g(N, {
14599
14547
  initial: !1,
14600
- children: C && /* @__PURE__ */ g(P.div, {
14548
+ children: x && /* @__PURE__ */ g(P.div, {
14601
14549
  className: Zh.saveAction,
14602
14550
  initial: { width: 0 },
14603
14551
  animate: { width: "auto" },
14604
14552
  exit: { width: 0 },
14605
- transition: v,
14553
+ transition: y,
14606
14554
  children: /* @__PURE__ */ _(P.div, {
14607
14555
  className: Zh.saveButton,
14608
14556
  initial: {
14609
- x: h ? 0 : 16,
14557
+ x: v ? 0 : 16,
14610
14558
  opacity: 0
14611
14559
  },
14612
14560
  animate: {
@@ -14614,21 +14562,21 @@ function ag({ views: e = [], state: t, onStateChange: n, columnDefinitions: r =
14614
14562
  opacity: 1
14615
14563
  },
14616
14564
  exit: {
14617
- x: h ? 0 : 16,
14565
+ x: v ? 0 : 16,
14618
14566
  opacity: 0
14619
14567
  },
14620
- transition: v,
14621
- children: [/* @__PURE__ */ g(V, {
14568
+ transition: y,
14569
+ children: [b && /* @__PURE__ */ g(V, {
14622
14570
  type: "button",
14623
14571
  variant: "tertiary",
14624
14572
  icon: "clock-revert",
14625
- title: f("Reset view"),
14626
- disabled: !S,
14627
- onClick: () => S && T(S)
14573
+ title: h("Reset view"),
14574
+ onClick: () => i(b.state)
14628
14575
  }), /* @__PURE__ */ g(eg, {
14629
- view: x,
14630
- onViewUpdate: o,
14631
- onViewCreate: s
14576
+ selectedViewId: b?.id,
14577
+ state: r,
14578
+ onViewUpdate: c,
14579
+ onViewCreate: l
14632
14580
  })]
14633
14581
  })
14634
14582
  }, "save")
@@ -14638,16 +14586,16 @@ function ag({ views: e = [], state: t, onStateChange: n, columnDefinitions: r =
14638
14586
  ]
14639
14587
  }), /* @__PURE__ */ g(N, {
14640
14588
  initial: !1,
14641
- children: c && a.length > 0 && /* @__PURE__ */ g(P.div, {
14589
+ children: u && s.length > 0 && /* @__PURE__ */ g(P.div, {
14642
14590
  className: Zh.filterPanel,
14643
14591
  initial: { height: 0 },
14644
14592
  animate: { height: "auto" },
14645
14593
  exit: { height: 0 },
14646
- transition: v,
14594
+ transition: y,
14647
14595
  children: /* @__PURE__ */ g(P.div, {
14648
14596
  className: Zh.filters,
14649
14597
  initial: {
14650
- y: h ? 0 : -8,
14598
+ y: v ? 0 : -8,
14651
14599
  opacity: 0
14652
14600
  },
14653
14601
  animate: {
@@ -14655,15 +14603,15 @@ function ag({ views: e = [], state: t, onStateChange: n, columnDefinitions: r =
14655
14603
  opacity: 1
14656
14604
  },
14657
14605
  exit: {
14658
- y: h ? 0 : -8,
14606
+ y: v ? 0 : -8,
14659
14607
  opacity: 0
14660
14608
  },
14661
- transition: v,
14662
- children: a.map((e) => /* @__PURE__ */ g(Qh, {
14609
+ transition: y,
14610
+ children: s.map((e) => /* @__PURE__ */ g(Qh, {
14663
14611
  definition: e,
14664
- filter: x.filters.find((t) => t.key === e.key),
14665
- onChange: (t) => E(e.key, t)
14666
- }, `${x.id}:${e.key}`))
14612
+ filter: r.filters.find((t) => t.key === e.key),
14613
+ onChange: (t) => S(e.key, t)
14614
+ }, `${t}:${e.key}`))
14667
14615
  })
14668
14616
  }, "filters")
14669
14617
  })]
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@orient-ai/aurora-ui",
3
- "version": "1.0.0-alpha.8",
3
+ "version": "1.0.0-alpha.9",
4
4
  "description": "Aurora UI",
5
5
  "private": false,
6
6
  "type": "module",