@fileverse/ui 4.0.4 → 4.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.
@@ -262,6 +262,7 @@ export declare interface DynamicRadioProps {
262
262
  items: RadioCardProps[];
263
263
  className?: string;
264
264
  size?: "sm" | "lg";
265
+ content?: (selectedValue: string) => React.ReactNode;
265
266
  }
266
267
 
267
268
  export declare type FileType = "dDoc" | "dPage" | "whiteboard" | "note" | "link" | "media";
@@ -464,7 +465,7 @@ export declare interface RadioCardProps {
464
465
  selectedValue: string;
465
466
  value: string;
466
467
  size?: "sm" | "lg";
467
- content?: React.ReactNode | null;
468
+ content?: React.ReactNode;
468
469
  }
469
470
 
470
471
  export declare const RadioGroup: React_2.ForwardRefExoticComponent<Omit<RadioGroupPrimitive.RadioGroupProps & React_2.RefAttributes<HTMLDivElement>, "ref"> & React_2.RefAttributes<HTMLDivElement>>;
@@ -691,7 +692,7 @@ declare const toggleVariants: (props?: ({
691
692
  variant?: "default" | "hover" | "focus" | null | undefined;
692
693
  } & ClassProp) | undefined) => string;
693
694
 
694
- export declare const Tooltip: React_2.ForwardRefExoticComponent<TooltipProps & React_2.RefAttributes<HTMLElement>>;
695
+ export declare const Tooltip: React_2.ForwardRefExoticComponent<TooltipProps & React_2.RefAttributes<HTMLDivElement>>;
695
696
 
696
697
  export declare interface TooltipProps extends React_2.HTMLAttributes<HTMLElement>, VariantProps<typeof tooltipVariants> {
697
698
  text: string;
package/dist/index.es.js CHANGED
@@ -32461,27 +32461,20 @@ const AnimatePresence = ({ children: x, custom: C, initial: S = !0, onExitComple
32461
32461
  exit: { opacity: 0, x: 0, transition: { ease: "easeInOut", duration: 0.1 } }
32462
32462
  }
32463
32463
  }, Tooltip = React.forwardRef(
32464
- ({
32465
- children: x,
32466
- className: C,
32467
- text: S,
32468
- position: E,
32469
- beakAlignment: P,
32470
- sideOffset: L = 5,
32471
- ...j
32472
- }) => {
32473
- const _ = ({
32474
- position: O,
32475
- beakAlignment: z
32464
+ ({ children: x, className: C, text: S, position: E, beakAlignment: P, sideOffset: L = 5, ...j }, _) => {
32465
+ const O = ({
32466
+ position: z,
32467
+ beakAlignment: q
32476
32468
  }) => {
32477
- const q = O === "bottom" || O === "top", te = O === "right" || O === "left";
32478
- return q && z === "start" ? "[&>span]:!left-[10%]" : te && z === "start" ? "[&>span]:!top-[20%]" : q && z === "end" ? "[&>span]:!left-[80%]" : te && z === "end" ? "[&>span]:!top-[60%]" : te && z === "center" ? "my-0 -mx-1" : "-my-1";
32469
+ const te = z === "bottom" || z === "top", ee = z === "right" || z === "left";
32470
+ return te && q === "start" ? "[&>span]:!left-[10%]" : ee && q === "start" ? "[&>span]:!top-[20%]" : te && q === "end" ? "[&>span]:!left-[80%]" : ee && q === "end" ? "[&>span]:!top-[60%]" : ee && q === "center" ? "my-0 -mx-1" : "-my-1";
32479
32471
  };
32480
32472
  return /* @__PURE__ */ jsxRuntimeExports.jsx(TooltipProvider$1, { children: /* @__PURE__ */ jsxRuntimeExports.jsxs(TooltipRoot, { children: [
32481
32473
  /* @__PURE__ */ jsxRuntimeExports.jsx(TooltipTrigger$1, { "data-testid": "tooltip-trigger", children: x }),
32482
32474
  /* @__PURE__ */ jsxRuntimeExports.jsx(TooltipPortal, { children: /* @__PURE__ */ jsxRuntimeExports.jsx(
32483
32475
  motion.div,
32484
32476
  {
32477
+ ref: _,
32485
32478
  initial: positionAnimations[E || "top"].initial,
32486
32479
  animate: positionAnimations[E || "top"].animate,
32487
32480
  exit: positionAnimations[E || "top"].exit,
@@ -32499,7 +32492,7 @@ const AnimatePresence = ({ children: x, custom: C, initial: S = !0, onExitComple
32499
32492
  className: cn(
32500
32493
  "max-w-sm min-h-[2vh] overflow-hidden rounded color-bg-default-inverse p-2 text-helper-text-sm color-text-inverse text-center",
32501
32494
  tooltipVariants({ position: E, className: C }),
32502
- _({ position: E, beakAlignment: P }),
32495
+ O({ position: E, beakAlignment: P }),
32503
32496
  C
32504
32497
  ),
32505
32498
  ...j,
@@ -50310,49 +50303,28 @@ const RadioCard = ({
50310
50303
  /* @__PURE__ */ jsxRuntimeExports.jsx(AnimatePresence, { initial: !1, children: L && E === P && /* @__PURE__ */ jsxRuntimeExports.jsx(RadioCardContent, { content: L }) })
50311
50304
  ] });
50312
50305
  }, DynamicRadio = forwardRef(
50313
- ({ items: x, className: C, size: S = "lg" }, E) => {
50314
- var j;
50315
- const [P, L] = useState((j = x[0]) == null ? void 0 : j.value);
50306
+ ({ items: x, className: C, size: S = "lg", content: E }, P) => {
50307
+ var _;
50308
+ const [L, j] = useState((_ = x[0]) == null ? void 0 : _.value);
50316
50309
  return !x || x.length === 0 ? null : /* @__PURE__ */ jsxRuntimeExports.jsx(
50317
50310
  RadioGroup,
50318
50311
  {
50319
- ref: E,
50320
- defaultValue: P,
50312
+ ref: P,
50313
+ defaultValue: L,
50321
50314
  className: cn("space-y-2 h-full", C),
50322
- onValueChange: (_) => L(_),
50323
- children: x.map((_, O) => /* @__PURE__ */ jsxRuntimeExports.jsx("div", { children: /* @__PURE__ */ jsxRuntimeExports.jsx(
50315
+ onValueChange: (O) => j(O),
50316
+ children: x.map((O, z) => /* @__PURE__ */ jsxRuntimeExports.jsx("div", { children: /* @__PURE__ */ jsxRuntimeExports.jsx(
50324
50317
  RadioCard,
50325
50318
  {
50326
- id: _.id,
50327
- value: _.value,
50328
- description: _.description,
50329
- label: _.label,
50330
- selectedValue: P,
50319
+ id: O.id,
50320
+ value: O.value,
50321
+ description: O.description,
50322
+ label: O.label,
50323
+ selectedValue: L,
50331
50324
  size: S,
50332
- content: _.value === P && _.value === "team" ? /* @__PURE__ */ jsxRuntimeExports.jsxs(jsxRuntimeExports.Fragment, { children: [
50333
- /* @__PURE__ */ jsxRuntimeExports.jsx(
50334
- DynamicContentController,
50335
- {
50336
- label: "Workspace global public portal",
50337
- description: "Enable the workspace global public portal. It will allow you to have a separate public space to publish content, files, links. Workspace members will be able to suggest a content. The portal might be enabled/disabled later in Settings. ",
50338
- checked: !1,
50339
- onChange: (z) => console.log(z),
50340
- size: S
50341
- }
50342
- ),
50343
- /* @__PURE__ */ jsxRuntimeExports.jsx(
50344
- DynamicContentController,
50345
- {
50346
- label: "Teams public portals",
50347
- description: "Enable public portal for teams. Teams public portal might be disabled by team or workspace administrators. ",
50348
- checked: !1,
50349
- onChange: (z) => console.log(z),
50350
- size: S
50351
- }
50352
- )
50353
- ] }) : null
50325
+ content: E ? E(L) : null
50354
50326
  }
50355
- ) }, O))
50327
+ ) }, z))
50356
50328
  }
50357
50329
  );
50358
50330
  }
@@ -50585,21 +50557,39 @@ const sheetVariants = cva(
50585
50557
  dismissible: E = !0,
50586
50558
  children: P,
50587
50559
  ...L
50588
- }, j) => /* @__PURE__ */ jsxRuntimeExports.jsxs(SheetPortal, { children: [
50589
- /* @__PURE__ */ jsxRuntimeExports.jsx(SheetOverlay, { className: S }),
50590
- /* @__PURE__ */ jsxRuntimeExports.jsxs(
50591
- Content$2,
50592
- {
50593
- ref: j,
50594
- className: cn(sheetVariants({ side: x }), C),
50595
- ...L,
50596
- children: [
50597
- E && /* @__PURE__ */ jsxRuntimeExports.jsx(Close, { className: "absolute right-4 top-3 rounded-sm ring-offset-white hover:color-bg-default-hover p-1 transition-colors focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-focused focus-visible:ring-offset-2 disabled:pointer-events-none data-[state=open]:color-bg-default-selected data-[state=open]:color-text-default", children: /* @__PURE__ */ jsxRuntimeExports.jsx(Icon$1, { name: "Close", className: "h-5 w-5", fill: "#363B3F" }) }),
50598
- P
50599
- ]
50600
- }
50601
- )
50602
- ] })
50560
+ }, j) => {
50561
+ const _ = React.useRef(null), O = React.useRef(0), z = React.useRef(0), q = (ee) => {
50562
+ O.current = ee.touches[0].clientX, z.current = ee.touches[0].clientY;
50563
+ }, te = (ee) => {
50564
+ var ne, se, ie, ce;
50565
+ const ae = ee.changedTouches[0].clientX, oe = ee.changedTouches[0].clientY, re = ae - O.current, ke = oe - z.current;
50566
+ x === "left" && re < -50 ? (ne = _.current) == null || ne.click() : x === "right" && re > 50 ? (se = _.current) == null || se.click() : x === "bottom" && ke > 50 ? (ie = _.current) == null || ie.click() : x === "top" && ke < -50 && ((ce = _.current) == null || ce.click());
50567
+ };
50568
+ return /* @__PURE__ */ jsxRuntimeExports.jsxs(SheetPortal, { children: [
50569
+ /* @__PURE__ */ jsxRuntimeExports.jsx(SheetOverlay, { className: S }),
50570
+ /* @__PURE__ */ jsxRuntimeExports.jsxs(
50571
+ Content$2,
50572
+ {
50573
+ ref: j,
50574
+ className: cn(sheetVariants({ side: x }), C),
50575
+ ...L,
50576
+ onTouchStart: q,
50577
+ onTouchEnd: te,
50578
+ children: [
50579
+ E && /* @__PURE__ */ jsxRuntimeExports.jsx(
50580
+ Close,
50581
+ {
50582
+ ref: _,
50583
+ className: "absolute right-4 top-3 rounded-sm ring-offset-white hover:color-bg-default-hover p-1 transition-colors focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-focused focus-visible:ring-offset-2 disabled:pointer-events-none data-[state=open]:color-bg-default-selected data-[state=open]:color-text-default",
50584
+ children: /* @__PURE__ */ jsxRuntimeExports.jsx(Icon$1, { name: "Close", className: "h-5 w-5", fill: "#363B3F" })
50585
+ }
50586
+ ),
50587
+ P
50588
+ ]
50589
+ }
50590
+ )
50591
+ ] });
50592
+ }
50603
50593
  );
50604
50594
  SheetContent.displayName = Content$2.displayName;
50605
50595
  const SheetHeader = ({
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@fileverse/ui",
3
- "version": "4.0.4",
3
+ "version": "4.0.5",
4
4
  "files": [
5
5
  "/dist"
6
6
  ],
@@ -103,7 +103,7 @@
103
103
  "vitest": "^1.4.0"
104
104
  },
105
105
  "lint-staged": {
106
- "*.js|jsx|ts|tsx": [
106
+ "**/*.(+js|jsx|ts|tsx)": [
107
107
  "npx eslint --fix",
108
108
  "npx prettier --write"
109
109
  ],