elseware-ui 2.37.0 → 2.37.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.
package/dist/index.mjs CHANGED
@@ -19568,25 +19568,24 @@ function TextArea({
19568
19568
  ] });
19569
19569
  }
19570
19570
  var TextArea_default = TextArea;
19571
- function ContentArea({
19572
- children,
19573
- styles,
19574
- enablePadding = false
19575
- }) {
19576
- return /* @__PURE__ */ jsx(
19577
- "div",
19578
- {
19579
- className: classNames17({
19580
- "min-h-screen h-full w-full py-3 px-5": true,
19581
- "py-3 px-5": !enablePadding,
19582
- "py-3 px-5 lg:px-[150px]": enablePadding,
19583
- "transition-all duration-[200ms]": true,
19584
- [`${styles}`]: styles
19585
- }),
19586
- children
19587
- }
19588
- );
19589
- }
19571
+ var ContentArea = forwardRef(
19572
+ ({ children, styles, enablePadding = false }, ref) => {
19573
+ return /* @__PURE__ */ jsx(
19574
+ "div",
19575
+ {
19576
+ ref,
19577
+ className: classNames17({
19578
+ "min-h-screen h-full w-full transition-all duration-[200ms]": true,
19579
+ "py-3 px-5": !enablePadding,
19580
+ "py-3 px-5 lg:px-[150px]": enablePadding,
19581
+ [`${styles}`]: Boolean(styles)
19582
+ }),
19583
+ children
19584
+ }
19585
+ );
19586
+ }
19587
+ );
19588
+ ContentArea.displayName = "ContentArea";
19590
19589
  var ContentArea_default = ContentArea;
19591
19590
  function FlexCol({ children, gap = 3, styles }) {
19592
19591
  return /* @__PURE__ */ jsx(
@@ -20168,26 +20167,40 @@ var Drawer = ({
20168
20167
  side = "left",
20169
20168
  handleClose,
20170
20169
  styles,
20170
+ backdropStyles,
20171
20171
  showBackdrop = true,
20172
- closeOnBackdropClick = true
20172
+ closeOnBackdropClick = true,
20173
+ offsetTop = "0px",
20174
+ offsetBottom = "0px"
20173
20175
  }) => {
20174
20176
  const isHorizontal = side === "left" || side === "right";
20175
20177
  const isMobile = useIsMobile_default();
20178
+ const hasOffset = offsetTop !== "0px" || offsetBottom !== "0px";
20179
+ const drawerStyle = isHorizontal ? {
20180
+ top: offsetTop,
20181
+ bottom: offsetBottom,
20182
+ height: hasOffset ? `calc(100vh - ${offsetTop} - ${offsetBottom})` : void 0
20183
+ } : void 0;
20176
20184
  return /* @__PURE__ */ jsxs(Fragment, { children: [
20177
20185
  isMobile && showBackdrop && /* @__PURE__ */ jsx(TransitionFade_default, { visibility, leaveDuration: 200, children: /* @__PURE__ */ jsx(
20178
20186
  "div",
20179
20187
  {
20180
- className: "fixed inset-0 bg-black/50 z-40",
20188
+ className: classNames17(
20189
+ "fixed inset-0 bg-black/50 z-40",
20190
+ backdropStyles
20191
+ ),
20181
20192
  onClick: closeOnBackdropClick ? handleClose : void 0
20182
20193
  }
20183
20194
  ) }),
20184
20195
  /* @__PURE__ */ jsx(TransitionSlide_default, { visibility, side, leaveDuration: 200, children: /* @__PURE__ */ jsx(
20185
20196
  "div",
20186
20197
  {
20198
+ style: drawerStyle,
20187
20199
  className: classNames17(
20188
20200
  "fixed shadow-lg z-50",
20189
20201
  {
20190
- "h-full w-[300px] top-0": isHorizontal,
20202
+ "h-full w-[300px] top-0": isHorizontal && !hasOffset,
20203
+ "w-[300px]": isHorizontal && hasOffset,
20191
20204
  "w-full h-[300px] left-0": !isHorizontal,
20192
20205
  "left-0": side === "left",
20193
20206
  "right-0": side === "right",
@@ -21723,16 +21736,20 @@ function CommentHeader({ comment, config }) {
21723
21736
  var CommentHeader_default = CommentHeader;
21724
21737
  var useDrawer = (defaultVisibility = true) => {
21725
21738
  const [show, setShow] = useState(defaultVisibility);
21726
- const openDrawer = () => {
21727
- setShow((prev) => !prev);
21728
- };
21729
- const closeDrawer = () => {
21739
+ const openDrawer = useCallback(() => {
21740
+ setShow(true);
21741
+ }, []);
21742
+ const closeDrawer = useCallback(() => {
21730
21743
  setShow(false);
21731
- };
21744
+ }, []);
21745
+ const toggleDrawer = useCallback(() => {
21746
+ setShow((prev) => !prev);
21747
+ }, []);
21732
21748
  return {
21733
21749
  show,
21734
21750
  openDrawer,
21735
- closeDrawer
21751
+ closeDrawer,
21752
+ toggleDrawer
21736
21753
  };
21737
21754
  };
21738
21755
  var useDrawer_default = useDrawer;
@@ -23533,12 +23550,7 @@ function MyReviewPanel({
23533
23550
  maxRating: config.maxRating
23534
23551
  }
23535
23552
  ),
23536
- config.allowRecommendation && /* @__PURE__ */ jsx(
23537
- RecommendationComponent,
23538
- {
23539
- isRecommended: myReview.isRecommended
23540
- }
23541
- )
23553
+ config.allowRecommendation && /* @__PURE__ */ jsx(RecommendationComponent, { isRecommended: myReview.isRecommended })
23542
23554
  ] })
23543
23555
  ] }) })
23544
23556
  ] });
@@ -23912,7 +23924,13 @@ function ReviewItem({
23912
23924
  ] }),
23913
23925
  /* @__PURE__ */ jsx(ContentComponent, { review }),
23914
23926
  /* @__PURE__ */ jsxs("div", { className: "flex flex-wrap items-center gap-3", children: [
23915
- /* @__PURE__ */ jsx(RatingComponent, { rating: review.rating, maxRating: config.maxRating }),
23927
+ /* @__PURE__ */ jsx(
23928
+ RatingComponent,
23929
+ {
23930
+ rating: review.rating,
23931
+ maxRating: config.maxRating
23932
+ }
23933
+ ),
23916
23934
  config.allowRecommendation && /* @__PURE__ */ jsx(RecommendationComponent, { isRecommended: review.isRecommended })
23917
23935
  ] }),
23918
23936
  /* @__PURE__ */ jsx(
@@ -23963,13 +23981,7 @@ function ReviewList({
23963
23981
  const ItemComponent = components?.Item ?? ReviewItem_default;
23964
23982
  const EmptyStateComponent = components?.EmptyState ?? ReviewEmptyState_default;
23965
23983
  if (!reviews.length) {
23966
- return /* @__PURE__ */ jsx(
23967
- EmptyStateComponent,
23968
- {
23969
- title: config.emptyTitle,
23970
- text: config.emptyText
23971
- }
23972
- );
23984
+ return /* @__PURE__ */ jsx(EmptyStateComponent, { title: config.emptyTitle, text: config.emptyText });
23973
23985
  }
23974
23986
  return /* @__PURE__ */ jsx("div", { className: "flex flex-col gap-5", children: reviews.map((review) => /* @__PURE__ */ jsx(
23975
23987
  ItemComponent,
@@ -24192,12 +24204,7 @@ function useReviewThreadState({
24192
24204
  setIsCreatingReviewReply(false);
24193
24205
  }
24194
24206
  },
24195
- [
24196
- applyReview,
24197
- applyReviewUpdater,
24198
- config.maxRepliesPerReview,
24199
- dataSource
24200
- ]
24207
+ [applyReview, applyReviewUpdater, config.maxRepliesPerReview, dataSource]
24201
24208
  );
24202
24209
  const updateReviewReply2 = useCallback(
24203
24210
  async (input) => {