caplink-saas-ui-shared-component-library 1.57.0 → 1.57.2

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.
@@ -8,11 +8,13 @@ export type FancyAccordionProps = {
8
8
  className?: string;
9
9
  title: string;
10
10
  description?: string;
11
+ isOpen?: boolean;
12
+ onToggle?(): void;
11
13
  leftElement?: ReactNode;
12
14
  rightElement?: (toggleButtonElement: ReactNode) => JSX.Element;
13
- status: FancyAccordionStatusEnum;
14
- style: CSSProperties;
15
+ status?: FancyAccordionStatusEnum;
16
+ style?: CSSProperties;
15
17
  defaultShowDescription?: boolean;
16
18
  defaultShowContent?: boolean;
17
19
  };
18
- export declare function FancyAccordion({ className, title, description, status, style, children, leftElement, rightElement, defaultShowDescription, defaultShowContent, }: PropsWithChildren<FancyAccordionProps>): import("react/jsx-runtime").JSX.Element;
20
+ export declare function FancyAccordion({ className, title, description, status, style, children, leftElement, rightElement, defaultShowDescription, defaultShowContent, isOpen, onToggle, }: PropsWithChildren<FancyAccordionProps>): import("react/jsx-runtime").JSX.Element;
package/dist/index.es.js CHANGED
@@ -24370,47 +24370,55 @@ function l_e({
24370
24370
  style: s = { width: "100%", maxWidth: 768 },
24371
24371
  children: o,
24372
24372
  leftElement: i,
24373
- rightElement: a = (u) => /* @__PURE__ */ h.jsx(h.Fragment, { children: u }),
24373
+ rightElement: a = (f) => /* @__PURE__ */ h.jsx(h.Fragment, { children: f }),
24374
24374
  defaultShowDescription: l = !1,
24375
- defaultShowContent: c = !0
24375
+ defaultShowContent: c = !0,
24376
+ isOpen: u,
24377
+ onToggle: d
24376
24378
  }) {
24377
- const [u, d] = se(c), [f, p] = se(l), [m, g] = se(!0), v = pe(), y = he(() => r === "Loading", [r]), b = he(() => r === "Success", [r]), { ref: x, checkOverflow: w, overflowInfo: C } = Oq(1), E = he(
24378
- () => C.hasOverflow || C.numberOfLines > 1,
24379
- [C.hasOverflow, C.numberOfLines]
24380
- ), _ = ne(() => d((B) => !B), []), T = ne(() => {
24381
- const B = !f;
24382
- if (p(B), v.current && clearTimeout(v.current), B || m) {
24383
- g(!1);
24379
+ const [f, p] = se(c || u), [m, g] = se(l), [v, y] = se(!0), b = pe(), x = he(() => r === "Loading", [r]), w = he(() => r === "Success", [r]), { ref: C, checkOverflow: E, overflowInfo: _ } = Oq(1), T = he(
24380
+ () => _.hasOverflow || _.numberOfLines > 1,
24381
+ [_.hasOverflow, _.numberOfLines]
24382
+ ), N = ne(() => {
24383
+ p((L) => !L), d?.();
24384
+ }, [d]), M = ne(() => {
24385
+ const L = !m;
24386
+ if (g(L), b.current && clearTimeout(b.current), L || v) {
24387
+ y(!1);
24384
24388
  return;
24385
24389
  }
24386
- v.current = setTimeout(() => {
24387
- g(!0);
24390
+ b.current = setTimeout(() => {
24391
+ y(!0);
24388
24392
  }, 200);
24389
- }, [f, m]);
24393
+ }, [m, v]);
24390
24394
  re(() => () => {
24391
- v.current && clearTimeout(v.current);
24395
+ b.current && clearTimeout(b.current);
24392
24396
  }, []);
24393
- const N = he(
24397
+ const R = he(
24394
24398
  () => $(
24395
- "sl-border sl-relative sl-p-4 sl-rounded-lg",
24396
- b ? "sl-border-success-300" : y ? "" : "sl-border-foreground-v2-100 hover:sl-border-foreground-v2-500",
24399
+ "sl-border sl-relative sl-p-4 sl-rounded-lg sl-bg-white",
24400
+ w ? "sl-border-success-300" : x ? "" : "sl-border-foreground-v2-100 hover:sl-border-foreground-v2-500",
24397
24401
  t
24398
24402
  ),
24399
- [b, y, t]
24400
- ), M = he(
24401
- () => o && !y ? /* @__PURE__ */ h.jsx(
24403
+ [w, x, t]
24404
+ ), j = he(
24405
+ () => o && !x ? /* @__PURE__ */ h.jsx(
24402
24406
  Xd.button,
24403
24407
  {
24404
24408
  "data-testid": "fancy-accordion-toggle-button",
24405
- animate: { rotateX: u ? 0 : 180 },
24409
+ animate: { rotateX: f ? 0 : 180 },
24406
24410
  transition: { ease: "backInOut" },
24407
24411
  type: "button",
24408
- onClick: _,
24412
+ onClick: N,
24409
24413
  children: /* @__PURE__ */ h.jsx(ub, { className: "sl-size-4 sl-text-foreground-v2-500" })
24410
24414
  }
24411
24415
  ) : void 0,
24412
- [o, y, u, _]
24413
- ), R = he(
24416
+ [o, x, f, N]
24417
+ );
24418
+ re(() => {
24419
+ p(c || u);
24420
+ }, [c, u]);
24421
+ const B = he(
24414
24422
  () => /* @__PURE__ */ h.jsxs("div", { className: "sl-flex sl-items-start sl-justify-between sl-gap-4", children: [
24415
24423
  /* @__PURE__ */ h.jsxs("div", { className: "sl-flex sl-items-start sl-gap-4", children: [
24416
24424
  i,
@@ -24419,6 +24427,7 @@ function l_e({
24419
24427
  "h3",
24420
24428
  {
24421
24429
  "data-testid": "fancy-accordion-title",
24430
+ "data-cypress": `task-view-${e}`,
24422
24431
  className: $(
24423
24432
  "sl-text-xl sl-font-bold sl-text-foreground-v2-700 sl-flex sl-items-center",
24424
24433
  n ? "sl-h-auto" : "sl-h-[44px]"
@@ -24431,16 +24440,16 @@ function l_e({
24431
24440
  {
24432
24441
  "data-testid": "fancy-accordion-description-container",
24433
24442
  className: "sl-overflow-hidden sl-w-full sl-h-[22px]",
24434
- animate: { height: f ? "auto" : 22 },
24443
+ animate: { height: m ? "auto" : 22 },
24435
24444
  children: /* @__PURE__ */ h.jsx(
24436
24445
  "div",
24437
24446
  {
24438
- ref: x,
24447
+ ref: C,
24439
24448
  className: $(
24440
24449
  "sl-w-full sl-relative",
24441
- !f && m && "sl-line-clamp-1"
24450
+ !m && v && "sl-line-clamp-1"
24442
24451
  ),
24443
- onResize: w,
24452
+ onResize: E,
24444
24453
  children: /* @__PURE__ */ h.jsx(
24445
24454
  ane.Viewer,
24446
24455
  {
@@ -24452,14 +24461,15 @@ function l_e({
24452
24461
  )
24453
24462
  }
24454
24463
  ),
24455
- E && /* @__PURE__ */ h.jsx(
24464
+ T && /* @__PURE__ */ h.jsx(
24456
24465
  "button",
24457
24466
  {
24458
24467
  "data-testid": "fancy-accordion-show-more-button",
24468
+ "data-cypress": `expand-task-${name}`,
24459
24469
  type: "button",
24460
24470
  className: "sl-text-info-300 sl-text-sm",
24461
- onClick: T,
24462
- children: f ? "Ver menos" : "Ver mais"
24471
+ onClick: M,
24472
+ children: m ? "Ver menos" : "Ver mais"
24463
24473
  }
24464
24474
  )
24465
24475
  ] })
@@ -24469,7 +24479,7 @@ function l_e({
24469
24479
  {
24470
24480
  "data-testid": "fancy-accordion-left-element",
24471
24481
  className: "sl-h-[44px] sl-flex sl-items-center sl-shrink-0",
24472
- children: a(M)
24482
+ children: a(j)
24473
24483
  }
24474
24484
  )
24475
24485
  ] }),
@@ -24478,42 +24488,42 @@ function l_e({
24478
24488
  a,
24479
24489
  e,
24480
24490
  n,
24481
- f,
24482
24491
  m,
24483
- x,
24484
- w,
24492
+ v,
24493
+ C,
24485
24494
  E,
24486
24495
  T,
24487
- M
24496
+ M,
24497
+ j
24488
24498
  ]
24489
- ), j = he(
24490
- () => o && !y ? /* @__PURE__ */ h.jsx(
24499
+ ), k = he(
24500
+ () => o && !x ? /* @__PURE__ */ h.jsx(
24491
24501
  Xd.div,
24492
24502
  {
24493
24503
  "data-testid": "fancy-accordion-content",
24494
24504
  className: $(
24495
24505
  "sl-grid sl-w-full sl-gap-4 sl-overflow-hidden sl-h-auto sl-px-px sl-pb-px sl-text-md sl-text-foreground-v2-600",
24496
- u ? "" : "[&_*]:sl-border-0"
24506
+ f ? "" : "[&_*]:sl-border-0"
24497
24507
  ),
24498
24508
  animate: {
24499
- height: u ? "auto" : 0,
24500
- marginTop: u ? 16 : 0
24509
+ height: f ? "auto" : 0,
24510
+ marginTop: f ? 16 : 0
24501
24511
  },
24502
24512
  children: o
24503
24513
  }
24504
24514
  ) : void 0,
24505
- [o, y, u]
24515
+ [o, x, f]
24506
24516
  );
24507
- return /* @__PURE__ */ h.jsxs("div", { "data-testid": "fancy-accordion-container", className: N, style: s, children: [
24508
- y && /* @__PURE__ */ h.jsx(
24517
+ return /* @__PURE__ */ h.jsxs("div", { "data-testid": "fancy-accordion-container", className: R, style: s, children: [
24518
+ x && /* @__PURE__ */ h.jsx(
24509
24519
  dY,
24510
24520
  {
24511
24521
  className: "sl-bg-gradient-to-l sl-from-blue-700 sl-via-blue-500 sl-to-blue-200",
24512
24522
  size: 140
24513
24523
  }
24514
24524
  ),
24515
- R,
24516
- j
24525
+ B,
24526
+ k
24517
24527
  ] });
24518
24528
  }
24519
24529
  function Sp(t) {