elseware-ui 3.0.14 → 3.0.15

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
@@ -6346,7 +6346,19 @@ function useButton(props) {
6346
6346
  onMouseMove: _onMouseMove,
6347
6347
  ...rootRest
6348
6348
  } = props;
6349
- const { shape: resolvedShape, size: resolvedSize, variant: resolvedVariant, appearance: resolvedAppearance } = useResolvedButtonConfig({ compact, mode, variant, appearance, shape, size });
6349
+ const {
6350
+ shape: resolvedShape,
6351
+ size: resolvedSize,
6352
+ variant: resolvedVariant,
6353
+ appearance: resolvedAppearance
6354
+ } = useResolvedButtonConfig({
6355
+ compact,
6356
+ mode,
6357
+ variant,
6358
+ appearance,
6359
+ shape,
6360
+ size
6361
+ });
6350
6362
  const tokens = buttonSizeTokens[resolvedSize];
6351
6363
  const variantClassName = resolveButtonVariantStyles({
6352
6364
  appearance: resolvedAppearance,
@@ -6378,106 +6390,112 @@ function useButton(props) {
6378
6390
  };
6379
6391
  }
6380
6392
  var WEB_ROOT = "relative overflow-hidden group inline-flex items-center justify-center gap-2 transition-all duration-300";
6381
- var Button = React26.forwardRef(function Button2(props, ref) {
6382
- const {
6383
- type: type2 = "button",
6384
- glow = true,
6385
- className,
6386
- contentClassName,
6387
- labelClassName,
6388
- accessibilityLabel,
6389
- accessibilityRole,
6390
- testID,
6391
- onClick,
6392
- onMouseMove
6393
- } = props;
6394
- const model = useButton(props);
6395
- const localRef = React26.useRef(null);
6396
- const setRef = (node2) => {
6397
- localRef.current = node2;
6398
- if (typeof ref === "function") ref(node2);
6399
- else if (ref) ref.current = node2;
6400
- };
6401
- const handleMouseMove = (e) => {
6402
- const btn = localRef.current;
6403
- if (btn && glow) {
6404
- const rect = btn.getBoundingClientRect();
6405
- btn.style.setProperty("--glow-x", `${e.clientX - rect.left}px`);
6406
- btn.style.setProperty("--glow-y", `${e.clientY - rect.top}px`);
6407
- }
6408
- onMouseMove?.(e);
6409
- };
6410
- const handleClick = (e) => {
6411
- onClick?.(e);
6412
- if (!e.defaultPrevented) model.onPress?.();
6413
- };
6414
- const iconGroup = /* @__PURE__ */ jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [
6415
- model.loading && /* @__PURE__ */ jsxRuntime.jsx(index_js.AiOutlineLoading, { className: "animate-spin z-10" }),
6416
- model.icon && /* @__PURE__ */ jsxRuntime.jsx(
6393
+ var Button = React26.forwardRef(
6394
+ function Button2(props, ref) {
6395
+ const {
6396
+ type: type2 = "button",
6397
+ glow = true,
6398
+ className,
6399
+ contentClassName,
6400
+ labelClassName,
6401
+ accessibilityLabel,
6402
+ accessibilityRole,
6403
+ testID,
6404
+ onClick,
6405
+ onMouseMove
6406
+ } = props;
6407
+ const model = useButton(props);
6408
+ const localRef = React26.useRef(null);
6409
+ const setRef = (node2) => {
6410
+ localRef.current = node2;
6411
+ if (typeof ref === "function") ref(node2);
6412
+ else if (ref) ref.current = node2;
6413
+ };
6414
+ const handleMouseMove = (e) => {
6415
+ const btn = localRef.current;
6416
+ if (btn && glow) {
6417
+ const rect = btn.getBoundingClientRect();
6418
+ btn.style.setProperty("--glow-x", `${e.clientX - rect.left}px`);
6419
+ btn.style.setProperty("--glow-y", `${e.clientY - rect.top}px`);
6420
+ }
6421
+ onMouseMove?.(e);
6422
+ };
6423
+ const handleClick = (e) => {
6424
+ onClick?.(e);
6425
+ if (!e.defaultPrevented) model.onPress?.();
6426
+ };
6427
+ const iconGroup = /* @__PURE__ */ jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [
6428
+ model.loading && /* @__PURE__ */ jsxRuntime.jsx(index_js.AiOutlineLoading, { className: "animate-spin z-10" }),
6429
+ model.icon && /* @__PURE__ */ jsxRuntime.jsx(
6430
+ "span",
6431
+ {
6432
+ className: cn(
6433
+ "z-10 inline-flex shrink-0 items-center justify-center leading-none",
6434
+ contentClassName
6435
+ ),
6436
+ style: {
6437
+ height: model.iconSize,
6438
+ width: model.iconSize,
6439
+ lineHeight: 0
6440
+ },
6441
+ children: model.icon
6442
+ }
6443
+ )
6444
+ ] });
6445
+ const labelNode = model.label != null && model.label !== "" ? /* @__PURE__ */ jsxRuntime.jsx(
6417
6446
  "span",
6418
6447
  {
6419
6448
  className: cn(
6420
- "z-10 inline-flex shrink-0 items-center justify-center leading-none",
6421
- contentClassName
6449
+ "z-10 inline-flex items-center justify-center leading-none",
6450
+ labelClassName
6422
6451
  ),
6423
- style: { height: model.iconSize, width: model.iconSize, lineHeight: 0 },
6424
- children: model.icon
6452
+ style: { minHeight: model.iconSize },
6453
+ children: model.label
6425
6454
  }
6426
- )
6427
- ] });
6428
- const labelNode = model.label != null && model.label !== "" ? /* @__PURE__ */ jsxRuntime.jsx(
6429
- "span",
6430
- {
6431
- className: cn(
6432
- "z-10 inline-flex items-center justify-center leading-none",
6433
- labelClassName
6434
- ),
6435
- style: { minHeight: model.iconSize },
6436
- children: model.label
6437
- }
6438
- ) : null;
6439
- const trailing = model.iconPosition === "trailing";
6440
- return /* @__PURE__ */ jsxRuntime.jsxs(
6441
- "button",
6442
- {
6443
- ...model.rootRest,
6444
- ref: setRef,
6445
- type: type2,
6446
- disabled: model.isBusy,
6447
- onClick: handleClick,
6448
- onMouseMove: handleMouseMove,
6449
- "aria-disabled": model.isBusy,
6450
- "aria-label": accessibilityLabel,
6451
- "aria-pressed": model.selected,
6452
- "data-testid": testID,
6453
- role: accessibilityRole,
6454
- className: cn(
6455
- WEB_ROOT,
6456
- model.variantClassName,
6457
- model.shapeClassName,
6458
- model.tokens.padding,
6459
- model.tokens.text,
6460
- model.block && "w-full",
6461
- model.isTextMode && buttonTextModeClassName,
6462
- model.isBusy ? "brightness-75 grayscale cursor-not-allowed" : "hover:cursor-pointer",
6463
- className
6464
- ),
6465
- children: [
6466
- glow && /* @__PURE__ */ jsxRuntime.jsx(
6467
- "span",
6468
- {
6469
- className: "pointer-events-none absolute inset-0 opacity-0 group-hover:opacity-100 transition-opacity duration-300",
6470
- style: {
6471
- background: "radial-gradient(200px circle at var(--glow-x) var(--glow-y), rgba(255,255,255,0.18), transparent 50%)"
6472
- }
6473
- }
6455
+ ) : null;
6456
+ const trailing = model.iconPosition === "trailing";
6457
+ return /* @__PURE__ */ jsxRuntime.jsxs(
6458
+ "button",
6459
+ {
6460
+ ...model.rootRest,
6461
+ ref: setRef,
6462
+ type: type2,
6463
+ disabled: model.isBusy,
6464
+ onClick: handleClick,
6465
+ onMouseMove: handleMouseMove,
6466
+ "aria-disabled": model.isBusy,
6467
+ "aria-label": accessibilityLabel,
6468
+ "aria-pressed": model.selected,
6469
+ "data-testid": testID,
6470
+ role: accessibilityRole,
6471
+ className: cn(
6472
+ WEB_ROOT,
6473
+ model.variantClassName,
6474
+ model.shapeClassName,
6475
+ model.tokens.padding,
6476
+ model.tokens.text,
6477
+ model.block && "w-full",
6478
+ model.isTextMode && buttonTextModeClassName,
6479
+ model.isBusy ? "brightness-75 grayscale cursor-not-allowed" : "hover:cursor-pointer",
6480
+ className
6474
6481
  ),
6475
- trailing ? labelNode : iconGroup,
6476
- trailing ? iconGroup : labelNode
6477
- ]
6478
- }
6479
- );
6480
- });
6482
+ children: [
6483
+ glow && /* @__PURE__ */ jsxRuntime.jsx(
6484
+ "span",
6485
+ {
6486
+ className: "pointer-events-none absolute inset-0 opacity-0 group-hover:opacity-100 transition-opacity duration-300",
6487
+ style: {
6488
+ background: "radial-gradient(200px circle at var(--glow-x) var(--glow-y), rgba(255,255,255,0.18), transparent 50%)"
6489
+ }
6490
+ }
6491
+ ),
6492
+ trailing ? labelNode : iconGroup,
6493
+ trailing ? iconGroup : labelNode
6494
+ ]
6495
+ }
6496
+ );
6497
+ }
6498
+ );
6481
6499
  var Button_web_default = Button;
6482
6500
 
6483
6501
  // src/data/styles/shared.styles.tsx
@@ -33196,6 +33214,10 @@ var TopNav = ({
33196
33214
  }
33197
33215
  );
33198
33216
  };
33217
+ var RECOMMENDATION_OPTIONS = [
33218
+ { label: "Yes", value: "yes" },
33219
+ { label: "No", value: "no" }
33220
+ ];
33199
33221
  function ReviewForm({
33200
33222
  initialValues,
33201
33223
  placeholder = "Write your review...",
@@ -33203,163 +33225,85 @@ function ReviewForm({
33203
33225
  cancelLabel = "Cancel",
33204
33226
  loading = false,
33205
33227
  disabled = false,
33206
- autoFocus = false,
33207
33228
  config,
33208
33229
  onSubmit,
33209
33230
  onCancel
33210
33231
  }) {
33211
- const [content3, setContent] = React26.useState(initialValues?.content ?? "");
33212
- const [rating, setRating] = React26.useState(initialValues?.rating ?? 0);
33213
- const [isRecommended, setIsRecommended] = React26.useState(
33214
- initialValues?.isRecommended ?? true
33215
- );
33216
- const [error, setError] = React26.useState("");
33217
- const contentLength = content3.trim().length;
33218
- const ratingItems = React26.useMemo(() => {
33219
- return Array.from(
33220
- {
33221
- length: config.maxRating
33222
- },
33223
- (_2, index3) => index3 + 1
33224
- );
33225
- }, [config.maxRating]);
33226
- React26.useEffect(() => {
33227
- setContent(initialValues?.content ?? "");
33228
- setRating(initialValues?.rating ?? 0);
33229
- setIsRecommended(initialValues?.isRecommended ?? true);
33230
- setError("");
33231
- }, [
33232
- initialValues?.content,
33233
- initialValues?.rating,
33234
- initialValues?.isRecommended
33235
- ]);
33236
- function validate() {
33237
- const trimmedContent = content3.trim();
33238
- if (trimmedContent.length < config.minContentLength) {
33239
- return `Review must be at least ${config.minContentLength} characters.`;
33240
- }
33241
- if (trimmedContent.length > config.maxContentLength) {
33242
- return `Review cannot be more than ${config.maxContentLength} characters.`;
33243
- }
33244
- if (rating < config.minRating) {
33245
- return "Please select a rating.";
33246
- }
33247
- return "";
33248
- }
33249
- async function handleSubmit() {
33250
- const nextError = validate();
33251
- if (nextError) {
33252
- setError(nextError);
33253
- return;
33254
- }
33255
- const values = {
33256
- content: content3.trim(),
33257
- rating,
33258
- isRecommended: config.allowRecommendation ? isRecommended : void 0
33232
+ const formInitialValues = {
33233
+ content: initialValues?.content ?? "",
33234
+ rating: initialValues?.rating ?? 0,
33235
+ isRecommended: initialValues?.isRecommended ?? true ? "yes" : "no"
33236
+ };
33237
+ async function handleSubmit(values) {
33238
+ const normalized = {
33239
+ content: values.content.trim(),
33240
+ rating: Number(values.rating),
33241
+ isRecommended: config.allowRecommendation ? values.isRecommended === "yes" : void 0
33259
33242
  };
33260
- await onSubmit(values);
33243
+ await onSubmit(normalized);
33261
33244
  }
33262
- return /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex flex-col gap-4", children: [
33263
- /* @__PURE__ */ jsxRuntime.jsx(
33264
- "textarea",
33265
- {
33266
- value: content3,
33267
- disabled: disabled || loading,
33268
- autoFocus,
33269
- placeholder,
33270
- maxLength: config.maxContentLength,
33271
- onChange: (event) => {
33272
- setContent(event.target.value);
33273
- setError("");
33274
- },
33275
- className: "min-h-[120px] w-full resize-none rounded-xl border border-gray-300 bg-white px-4 py-3 text-sm text-gray-900 outline-none transition-colors placeholder:text-gray-400 focus:border-blue-500 disabled:cursor-not-allowed disabled:opacity-60 dark:border-neutral-700 dark:bg-neutral-900 dark:text-gray-100 dark:placeholder:text-gray-500"
33276
- }
33277
- ),
33278
- /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex items-center justify-between gap-3 text-xs text-gray-500 dark:text-gray-400", children: [
33279
- /* @__PURE__ */ jsxRuntime.jsxs("span", { children: [
33280
- contentLength,
33281
- "/",
33282
- config.maxContentLength
33283
- ] }),
33284
- error && /* @__PURE__ */ jsxRuntime.jsx("span", { className: "text-red-500", children: error })
33285
- ] }),
33286
- /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex flex-col gap-2", children: [
33287
- /* @__PURE__ */ jsxRuntime.jsx("span", { className: "text-sm font-medium text-gray-700 dark:text-gray-300", children: "Rating" }),
33288
- /* @__PURE__ */ jsxRuntime.jsx("div", { className: "flex items-center gap-1", children: ratingItems.map((item) => {
33289
- const active = item <= rating;
33290
- return /* @__PURE__ */ jsxRuntime.jsx(
33291
- "button",
33292
- {
33293
- type: "button",
33294
- disabled: disabled || loading,
33295
- onClick: () => {
33296
- setRating(item);
33297
- setError("");
33298
- },
33299
- className: `
33300
- text-2xl leading-none transition-transform disabled:cursor-not-allowed disabled:opacity-60
33301
- ${active ? "text-yellow-400" : "text-gray-300 dark:text-neutral-700"}
33302
- hover:scale-110
33303
- `,
33304
- "aria-label": `Rate ${item} out of ${config.maxRating}`,
33305
- children: "\u2605"
33306
- },
33307
- item
33308
- );
33309
- }) })
33310
- ] }),
33311
- config.allowRecommendation && /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex flex-col gap-2", children: [
33312
- /* @__PURE__ */ jsxRuntime.jsx("span", { className: "text-sm font-medium text-gray-700 dark:text-gray-300", children: "Do you recommend this?" }),
33313
- /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex flex-wrap gap-3", children: [
33314
- /* @__PURE__ */ jsxRuntime.jsxs("label", { className: "inline-flex cursor-pointer items-center gap-2 text-sm text-gray-700 dark:text-gray-300", children: [
33245
+ return /* @__PURE__ */ jsxRuntime.jsx(
33246
+ Form,
33247
+ {
33248
+ enableReinitialize: true,
33249
+ initialValues: formInitialValues,
33250
+ onSubmit: handleSubmit,
33251
+ children: (formik) => {
33252
+ const content3 = String(formik.values.content ?? "").trim();
33253
+ const rating = Number(formik.values.rating ?? 0);
33254
+ const isValid = content3.length >= config.minContentLength && rating >= config.minRating;
33255
+ const busy = loading || formik.isSubmitting;
33256
+ return /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex flex-col gap-4", children: [
33315
33257
  /* @__PURE__ */ jsxRuntime.jsx(
33316
- "input",
33258
+ TextArea,
33317
33259
  {
33318
- type: "radio",
33319
- checked: isRecommended,
33320
- disabled: disabled || loading,
33321
- onChange: () => setIsRecommended(true)
33260
+ name: "content",
33261
+ label: placeholder,
33262
+ placeholder,
33263
+ rows: 4,
33264
+ limit: config.maxContentLength,
33265
+ disabled: disabled || busy
33322
33266
  }
33323
33267
  ),
33324
- "Yes"
33325
- ] }),
33326
- /* @__PURE__ */ jsxRuntime.jsxs("label", { className: "inline-flex cursor-pointer items-center gap-2 text-sm text-gray-700 dark:text-gray-300", children: [
33327
- /* @__PURE__ */ jsxRuntime.jsx(
33328
- "input",
33268
+ /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex flex-col gap-2", children: [
33269
+ /* @__PURE__ */ jsxRuntime.jsx("span", { className: "text-sm font-medium text-gray-700 dark:text-gray-300", children: "Rating" }),
33270
+ /* @__PURE__ */ jsxRuntime.jsx(StarRatingInput_default, { name: "rating", starAmount: config.maxRating })
33271
+ ] }),
33272
+ config.allowRecommendation && /* @__PURE__ */ jsxRuntime.jsx(
33273
+ Radio_default,
33329
33274
  {
33330
- type: "radio",
33331
- checked: !isRecommended,
33332
- disabled: disabled || loading,
33333
- onChange: () => setIsRecommended(false)
33275
+ name: "isRecommended",
33276
+ placeholder: "Do you recommend this?",
33277
+ options: RECOMMENDATION_OPTIONS
33334
33278
  }
33335
33279
  ),
33336
- "No"
33337
- ] })
33338
- ] })
33339
- ] }),
33340
- /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex justify-end gap-2", children: [
33341
- onCancel && /* @__PURE__ */ jsxRuntime.jsx(
33342
- Button_web_default,
33343
- {
33344
- text: cancelLabel,
33345
- variant: "secondary",
33346
- appearance: "ghost",
33347
- disabled: loading,
33348
- onClick: onCancel
33349
- }
33350
- ),
33351
- /* @__PURE__ */ jsxRuntime.jsx(
33352
- Button_web_default,
33353
- {
33354
- text: submitLabel,
33355
- variant: "primary",
33356
- loading,
33357
- disabled: disabled || !content3.trim() || rating < config.minRating,
33358
- onClick: handleSubmit
33359
- }
33360
- )
33361
- ] })
33362
- ] });
33280
+ /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex justify-end gap-2", children: [
33281
+ onCancel && /* @__PURE__ */ jsxRuntime.jsx(
33282
+ Button_web_default,
33283
+ {
33284
+ type: "button",
33285
+ text: cancelLabel,
33286
+ variant: "secondary",
33287
+ appearance: "ghost",
33288
+ disabled: busy,
33289
+ onClick: onCancel
33290
+ }
33291
+ ),
33292
+ /* @__PURE__ */ jsxRuntime.jsx(
33293
+ Button_web_default,
33294
+ {
33295
+ type: "submit",
33296
+ text: submitLabel,
33297
+ variant: "primary",
33298
+ loading: busy,
33299
+ disabled: disabled || !isValid
33300
+ }
33301
+ )
33302
+ ] })
33303
+ ] });
33304
+ }
33305
+ }
33306
+ );
33363
33307
  }
33364
33308
  var ReviewForm_default = ReviewForm;
33365
33309
  function ReviewComposer({
@@ -33373,12 +33317,12 @@ function ReviewComposer({
33373
33317
  onSubmit
33374
33318
  }) {
33375
33319
  if (!currentUser) {
33376
- return /* @__PURE__ */ jsxRuntime.jsx("div", { className: "rounded-xl border border-gray-200 bg-white p-4 dark:border-neutral-800 dark:bg-neutral-900", children: /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex flex-wrap items-center justify-between gap-3", children: [
33377
- /* @__PURE__ */ jsxRuntime.jsx("p", { className: "text-sm text-gray-600 dark:text-gray-400", children: "Please login to post your review." }),
33320
+ return /* @__PURE__ */ jsxRuntime.jsx(Card_default, { styles: "p-4", children: /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex flex-wrap items-center justify-between gap-3", children: [
33321
+ /* @__PURE__ */ jsxRuntime.jsx(Typography.Caption, { children: "Please login to post your review." }),
33378
33322
  onLoginClick && /* @__PURE__ */ jsxRuntime.jsx(Button_web_default, { text: "Login", variant: "primary", onClick: onLoginClick })
33379
33323
  ] }) });
33380
33324
  }
33381
- return /* @__PURE__ */ jsxRuntime.jsx("div", { className: "rounded-xl border border-gray-200 bg-white p-4 dark:border-neutral-800 dark:bg-neutral-900", children: /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex gap-4", children: [
33325
+ return /* @__PURE__ */ jsxRuntime.jsx(Card_default, { styles: "p-4", children: /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex gap-4", children: [
33382
33326
  /* @__PURE__ */ jsxRuntime.jsx(Avatar, { src: currentUser.avatar, size: "md" }),
33383
33327
  /* @__PURE__ */ jsxRuntime.jsx("div", { className: "min-w-0 flex-1", children: /* @__PURE__ */ jsxRuntime.jsx(
33384
33328
  ReviewForm_default,
@@ -33608,48 +33552,23 @@ function ReviewHeader({ review, config }) {
33608
33552
  }
33609
33553
  var ReviewHeader_default = ReviewHeader;
33610
33554
  function ReviewContent({ review }) {
33611
- return /* @__PURE__ */ jsxRuntime.jsx("div", { className: "whitespace-pre-wrap break-words text-sm leading-6 text-gray-700 dark:text-gray-300", children: review.content });
33555
+ return /* @__PURE__ */ jsxRuntime.jsx(Typography.Paragraph, { className: "whitespace-pre-wrap break-words", children: review.content });
33612
33556
  }
33613
33557
  var ReviewContent_default = ReviewContent;
33614
33558
  function ReviewRating({ rating, maxRating }) {
33615
- const items = Array.from(
33616
- {
33617
- length: maxRating
33618
- },
33619
- (_2, index3) => index3 + 1
33620
- );
33621
- return /* @__PURE__ */ jsxRuntime.jsx(
33622
- "div",
33623
- {
33624
- className: "inline-flex items-center gap-0.5",
33625
- "aria-label": `${rating} out of ${maxRating}`,
33626
- children: items.map((item) => /* @__PURE__ */ jsxRuntime.jsx(
33627
- "span",
33628
- {
33629
- className: item <= rating ? "text-sm text-yellow-400" : "text-sm text-gray-300 dark:text-neutral-700",
33630
- children: "\u2605"
33631
- },
33632
- item
33633
- ))
33634
- }
33635
- );
33559
+ return /* @__PURE__ */ jsxRuntime.jsx(StarRating, { rating, max: maxRating, size: "sm" });
33636
33560
  }
33637
33561
  var ReviewRating_default = ReviewRating;
33638
33562
  function ReviewRecommendation({ isRecommended }) {
33639
33563
  if (typeof isRecommended !== "boolean") {
33640
33564
  return null;
33641
33565
  }
33642
- return /* @__PURE__ */ jsxRuntime.jsxs(
33643
- "span",
33566
+ return /* @__PURE__ */ jsxRuntime.jsx(
33567
+ Chip,
33644
33568
  {
33645
- className: `
33646
- inline-flex items-center gap-1 rounded-full px-2.5 py-1 text-xs font-medium
33647
- ${isRecommended ? "bg-green-500/10 text-green-500" : "bg-red-500/10 text-red-500"}
33648
- `,
33649
- children: [
33650
- isRecommended ? /* @__PURE__ */ jsxRuntime.jsx(index_js$5.BiCheckCircle, { size: 16 }) : /* @__PURE__ */ jsxRuntime.jsx(index_js$5.BiXCircle, { size: 16 }),
33651
- isRecommended ? "Recommended" : "Not Recommended"
33652
- ]
33569
+ label: isRecommended ? "Recommended" : "Not Recommended",
33570
+ variant: isRecommended ? "success" : "danger",
33571
+ appearance: "lite"
33653
33572
  }
33654
33573
  );
33655
33574
  }
@@ -33787,56 +33706,32 @@ function MyReviewPanel({
33787
33706
  ] });
33788
33707
  }
33789
33708
  var MyReviewPanel_default = MyReviewPanel;
33790
- function ReviewMenuItem({
33791
- icon,
33792
- name: name2,
33793
- badge,
33794
- to,
33795
- navigate,
33796
- className,
33797
- onClick,
33798
- style: style2
33799
- }) {
33800
- return /* @__PURE__ */ jsxRuntime.jsx(
33801
- MenuItem,
33802
- {
33803
- icon,
33804
- name: name2,
33805
- badge,
33806
- to,
33807
- navigate,
33808
- onClick,
33809
- style: style2,
33810
- className
33811
- }
33812
- );
33813
- }
33709
+ var MENU_ITEM_CLASS = "flex w-full items-center gap-2 px-4 py-3 text-sm hover:bg-gray-100 dark:hover:bg-neutral-800";
33814
33710
  function ReviewMenu({
33815
33711
  open,
33816
33712
  setOpen,
33817
33713
  canEdit,
33818
33714
  canDelete,
33819
33715
  canReport,
33820
- canReply,
33821
33716
  onEdit,
33822
33717
  onDelete,
33823
- onReport,
33824
- onReply
33718
+ onReport
33825
33719
  }) {
33826
33720
  const ref = React26.useRef(null);
33827
33721
  useClickOutside(ref, () => setOpen(false));
33722
+ const withClose = (action) => () => {
33723
+ setOpen(false);
33724
+ action?.();
33725
+ };
33828
33726
  const items = [];
33829
33727
  if (canEdit) {
33830
33728
  items.push({
33831
33729
  type: "item",
33832
33730
  icon: /* @__PURE__ */ jsxRuntime.jsx(index_js$5.BiEdit, {}),
33833
33731
  name: "Edit Review",
33834
- component: ReviewMenuItem,
33835
- onClick: () => {
33836
- setOpen(false);
33837
- onEdit?.();
33838
- },
33839
- className: "flex w-full items-center gap-2 px-4 py-3 text-sm hover:bg-gray-100 dark:hover:bg-neutral-800"
33732
+ component: MenuItem,
33733
+ onClick: withClose(onEdit),
33734
+ className: MENU_ITEM_CLASS
33840
33735
  });
33841
33736
  }
33842
33737
  if (canDelete) {
@@ -33844,12 +33739,9 @@ function ReviewMenu({
33844
33739
  type: "item",
33845
33740
  icon: /* @__PURE__ */ jsxRuntime.jsx(index_js$5.BiTrash, {}),
33846
33741
  name: "Delete Review",
33847
- component: ReviewMenuItem,
33848
- onClick: () => {
33849
- setOpen(false);
33850
- onDelete?.();
33851
- },
33852
- className: "flex w-full items-center gap-2 px-4 py-3 text-sm text-red-500 hover:bg-gray-100 dark:hover:bg-neutral-800"
33742
+ component: MenuItem,
33743
+ onClick: withClose(onDelete),
33744
+ className: `${MENU_ITEM_CLASS} text-red-500`
33853
33745
  });
33854
33746
  }
33855
33747
  if (canReport) {
@@ -33857,25 +33749,9 @@ function ReviewMenu({
33857
33749
  type: "item",
33858
33750
  icon: /* @__PURE__ */ jsxRuntime.jsx(index_js$5.BiFlag, {}),
33859
33751
  name: "Report Review",
33860
- component: ReviewMenuItem,
33861
- onClick: () => {
33862
- setOpen(false);
33863
- onReport?.();
33864
- },
33865
- className: "flex w-full items-center gap-2 px-4 py-3 text-sm hover:bg-gray-100 dark:hover:bg-neutral-800"
33866
- });
33867
- }
33868
- if (canReply) {
33869
- items.push({
33870
- type: "item",
33871
- icon: /* @__PURE__ */ jsxRuntime.jsx(index_js$5.BiReply, {}),
33872
- name: "Reply as Owner",
33873
- component: ReviewMenuItem,
33874
- onClick: () => {
33875
- setOpen(false);
33876
- onReply?.();
33877
- },
33878
- className: "flex w-full items-center gap-2 px-4 py-3 text-sm hover:bg-gray-100 dark:hover:bg-neutral-800"
33752
+ component: MenuItem,
33753
+ onClick: withClose(onReport),
33754
+ className: MENU_ITEM_CLASS
33879
33755
  });
33880
33756
  }
33881
33757
  if (!items.length) {
@@ -33896,20 +33772,20 @@ function ReviewMenu({
33896
33772
  ] });
33897
33773
  }
33898
33774
  var ReviewMenu_default = ReviewMenu;
33899
- function ReviewActions({ canReply, onReply }) {
33775
+ function ReviewActions({ canReply, config, onReply }) {
33900
33776
  if (!canReply) {
33901
33777
  return null;
33902
33778
  }
33903
- return /* @__PURE__ */ jsxRuntime.jsx("div", { className: "flex items-center gap-4 text-sm text-gray-500 dark:text-gray-400", children: /* @__PURE__ */ jsxRuntime.jsxs(
33904
- "button",
33779
+ return /* @__PURE__ */ jsxRuntime.jsx("div", { children: /* @__PURE__ */ jsxRuntime.jsx(
33780
+ Button_web_default,
33905
33781
  {
33906
33782
  type: "button",
33907
- onClick: onReply,
33908
- className: "inline-flex items-center gap-1 font-medium transition-colors hover:text-gray-900 dark:hover:text-gray-100",
33909
- children: [
33910
- /* @__PURE__ */ jsxRuntime.jsx(index_js$5.BiReply, { size: 18 }),
33911
- "Reply as Owner"
33912
- ]
33783
+ text: `Reply as ${config.ownerReplyLabel}`,
33784
+ variant: "secondary",
33785
+ appearance: "ghost",
33786
+ size: "sm",
33787
+ icon: /* @__PURE__ */ jsxRuntime.jsx(index_js$5.BiReply, {}),
33788
+ onClick: onReply
33913
33789
  }
33914
33790
  ) });
33915
33791
  }
@@ -33937,33 +33813,10 @@ function ReviewReplyHeader({ reply, config }) {
33937
33813
  }
33938
33814
  var ReviewReplyHeader_default = ReviewReplyHeader;
33939
33815
  function ReviewReplyContent({ reply }) {
33940
- return /* @__PURE__ */ jsxRuntime.jsx("div", { className: "whitespace-pre-wrap break-words text-sm leading-6 text-gray-700 dark:text-gray-300", children: reply.content });
33816
+ return /* @__PURE__ */ jsxRuntime.jsx(Typography.Paragraph, { className: "whitespace-pre-wrap break-words", children: reply.content });
33941
33817
  }
33942
33818
  var ReviewReplyContent_default = ReviewReplyContent;
33943
- function ReviewReplyMenuItem({
33944
- icon,
33945
- name: name2,
33946
- badge,
33947
- to,
33948
- navigate,
33949
- className,
33950
- onClick,
33951
- style: style2
33952
- }) {
33953
- return /* @__PURE__ */ jsxRuntime.jsx(
33954
- MenuItem,
33955
- {
33956
- icon,
33957
- name: name2,
33958
- badge,
33959
- to,
33960
- navigate,
33961
- onClick,
33962
- style: style2,
33963
- className
33964
- }
33965
- );
33966
- }
33819
+ var MENU_ITEM_CLASS2 = "flex w-full items-center gap-2 px-4 py-3 text-sm hover:bg-gray-100 dark:hover:bg-neutral-800";
33967
33820
  function ReviewReplyMenu({
33968
33821
  open,
33969
33822
  setOpen,
@@ -33976,18 +33829,19 @@ function ReviewReplyMenu({
33976
33829
  }) {
33977
33830
  const ref = React26.useRef(null);
33978
33831
  useClickOutside(ref, () => setOpen(false));
33832
+ const withClose = (action) => () => {
33833
+ setOpen(false);
33834
+ action?.();
33835
+ };
33979
33836
  const items = [];
33980
33837
  if (canEdit) {
33981
33838
  items.push({
33982
33839
  type: "item",
33983
33840
  icon: /* @__PURE__ */ jsxRuntime.jsx(index_js$5.BiEdit, {}),
33984
33841
  name: "Edit Reply",
33985
- component: ReviewReplyMenuItem,
33986
- onClick: () => {
33987
- setOpen(false);
33988
- onEdit?.();
33989
- },
33990
- className: "flex w-full items-center gap-2 px-4 py-3 text-sm hover:bg-gray-100 dark:hover:bg-neutral-800"
33842
+ component: MenuItem,
33843
+ onClick: withClose(onEdit),
33844
+ className: MENU_ITEM_CLASS2
33991
33845
  });
33992
33846
  }
33993
33847
  if (canDelete) {
@@ -33995,12 +33849,9 @@ function ReviewReplyMenu({
33995
33849
  type: "item",
33996
33850
  icon: /* @__PURE__ */ jsxRuntime.jsx(index_js$5.BiTrash, {}),
33997
33851
  name: "Delete Reply",
33998
- component: ReviewReplyMenuItem,
33999
- onClick: () => {
34000
- setOpen(false);
34001
- onDelete?.();
34002
- },
34003
- className: "flex w-full items-center gap-2 px-4 py-3 text-sm text-red-500 hover:bg-gray-100 dark:hover:bg-neutral-800"
33852
+ component: MenuItem,
33853
+ onClick: withClose(onDelete),
33854
+ className: `${MENU_ITEM_CLASS2} text-red-500`
34004
33855
  });
34005
33856
  }
34006
33857
  if (canReport) {
@@ -34008,12 +33859,9 @@ function ReviewReplyMenu({
34008
33859
  type: "item",
34009
33860
  icon: /* @__PURE__ */ jsxRuntime.jsx(index_js$5.BiFlag, {}),
34010
33861
  name: "Report Reply",
34011
- component: ReviewReplyMenuItem,
34012
- onClick: () => {
34013
- setOpen(false);
34014
- onReport?.();
34015
- },
34016
- className: "flex w-full items-center gap-2 px-4 py-3 text-sm hover:bg-gray-100 dark:hover:bg-neutral-800"
33862
+ component: MenuItem,
33863
+ onClick: withClose(onReport),
33864
+ className: MENU_ITEM_CLASS2
34017
33865
  });
34018
33866
  }
34019
33867
  if (!items.length) {
@@ -34145,11 +33993,9 @@ function ReviewItem({
34145
33993
  canEdit,
34146
33994
  canDelete,
34147
33995
  canReport,
34148
- canReply,
34149
33996
  onEdit: () => onEditReview?.(review),
34150
33997
  onDelete: () => onDeleteReview?.(review),
34151
- onReport: () => onReportReview?.(review),
34152
- onReply: () => onReplyToReview?.(review)
33998
+ onReport: () => onReportReview?.(review)
34153
33999
  }
34154
34000
  )
34155
34001
  ] }),
@@ -34168,6 +34014,7 @@ function ReviewItem({
34168
34014
  ActionsComponent,
34169
34015
  {
34170
34016
  review,
34017
+ config,
34171
34018
  canReply,
34172
34019
  onReply: () => onReplyToReview?.(review)
34173
34020
  }
@@ -34191,9 +34038,9 @@ function ReviewEmptyState({
34191
34038
  title = "No reviews yet",
34192
34039
  text: text10 = "There are no reviews to show."
34193
34040
  }) {
34194
- return /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "rounded-xl border border-dashed border-gray-300 bg-white p-8 text-center dark:border-neutral-800 dark:bg-neutral-900", children: [
34195
- /* @__PURE__ */ jsxRuntime.jsx("div", { className: "text-sm font-semibold text-gray-900 dark:text-gray-100", children: title }),
34196
- text10 && /* @__PURE__ */ jsxRuntime.jsx("p", { className: "mt-2 text-sm text-gray-500 dark:text-gray-400", children: text10 })
34041
+ return /* @__PURE__ */ jsxRuntime.jsxs(Info, { className: "flex flex-col items-center gap-1 text-center", children: [
34042
+ /* @__PURE__ */ jsxRuntime.jsx(Typography.Label, { bold: true, children: title }),
34043
+ text10 && /* @__PURE__ */ jsxRuntime.jsx(Typography.Caption, { children: text10 })
34197
34044
  ] });
34198
34045
  }
34199
34046
  var ReviewEmptyState_default = ReviewEmptyState;
@@ -35546,11 +35393,11 @@ function addChildren(props, children3) {
35546
35393
  }
35547
35394
  }
35548
35395
  }
35549
- function productionCreate(_2, jsx256, jsxs129) {
35396
+ function productionCreate(_2, jsx256, jsxs127) {
35550
35397
  return create3;
35551
35398
  function create3(_3, type2, props, key) {
35552
35399
  const isStaticChildren = Array.isArray(props.children);
35553
- const fn = isStaticChildren ? jsxs129 : jsx256;
35400
+ const fn = isStaticChildren ? jsxs127 : jsx256;
35554
35401
  return key ? fn(type2, props, key) : fn(type2, props);
35555
35402
  }
35556
35403
  }