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.mjs CHANGED
@@ -15,7 +15,7 @@ import { FaCircleChevronDown } from 'react-icons/fa6/index.js';
15
15
  import ReactWorldFlags from 'react-world-flags';
16
16
  import emojiFlags from 'emoji-flags';
17
17
  import { ComposableMap, Geographies, Geography, Marker } from 'react-simple-maps';
18
- import { BiCheckCircle, BiXCircle, BiChevronDown, BiChevronUp, BiSolidLike, BiLike, BiSolidDislike, BiDislike, BiDotsVerticalRounded, BiReply, BiEdit, BiTrash, BiFlag } from 'react-icons/bi/index.js';
18
+ import { BiChevronDown, BiChevronUp, BiSolidLike, BiLike, BiSolidDislike, BiDislike, BiDotsVerticalRounded, BiReply, BiEdit, BiTrash, BiFlag } from 'react-icons/bi/index.js';
19
19
  import CodeMirror from '@uiw/react-codemirror';
20
20
  import { markdown } from '@codemirror/lang-markdown';
21
21
  import { oneDark } from '@codemirror/theme-one-dark';
@@ -6336,7 +6336,19 @@ function useButton(props) {
6336
6336
  onMouseMove: _onMouseMove,
6337
6337
  ...rootRest
6338
6338
  } = props;
6339
- const { shape: resolvedShape, size: resolvedSize, variant: resolvedVariant, appearance: resolvedAppearance } = useResolvedButtonConfig({ compact, mode, variant, appearance, shape, size });
6339
+ const {
6340
+ shape: resolvedShape,
6341
+ size: resolvedSize,
6342
+ variant: resolvedVariant,
6343
+ appearance: resolvedAppearance
6344
+ } = useResolvedButtonConfig({
6345
+ compact,
6346
+ mode,
6347
+ variant,
6348
+ appearance,
6349
+ shape,
6350
+ size
6351
+ });
6340
6352
  const tokens = buttonSizeTokens[resolvedSize];
6341
6353
  const variantClassName = resolveButtonVariantStyles({
6342
6354
  appearance: resolvedAppearance,
@@ -6368,106 +6380,112 @@ function useButton(props) {
6368
6380
  };
6369
6381
  }
6370
6382
  var WEB_ROOT = "relative overflow-hidden group inline-flex items-center justify-center gap-2 transition-all duration-300";
6371
- var Button = forwardRef(function Button2(props, ref) {
6372
- const {
6373
- type: type2 = "button",
6374
- glow = true,
6375
- className,
6376
- contentClassName,
6377
- labelClassName,
6378
- accessibilityLabel,
6379
- accessibilityRole,
6380
- testID,
6381
- onClick,
6382
- onMouseMove
6383
- } = props;
6384
- const model = useButton(props);
6385
- const localRef = useRef(null);
6386
- const setRef = (node2) => {
6387
- localRef.current = node2;
6388
- if (typeof ref === "function") ref(node2);
6389
- else if (ref) ref.current = node2;
6390
- };
6391
- const handleMouseMove = (e) => {
6392
- const btn = localRef.current;
6393
- if (btn && glow) {
6394
- const rect = btn.getBoundingClientRect();
6395
- btn.style.setProperty("--glow-x", `${e.clientX - rect.left}px`);
6396
- btn.style.setProperty("--glow-y", `${e.clientY - rect.top}px`);
6397
- }
6398
- onMouseMove?.(e);
6399
- };
6400
- const handleClick = (e) => {
6401
- onClick?.(e);
6402
- if (!e.defaultPrevented) model.onPress?.();
6403
- };
6404
- const iconGroup = /* @__PURE__ */ jsxs(Fragment, { children: [
6405
- model.loading && /* @__PURE__ */ jsx(AiOutlineLoading, { className: "animate-spin z-10" }),
6406
- model.icon && /* @__PURE__ */ jsx(
6383
+ var Button = forwardRef(
6384
+ function Button2(props, ref) {
6385
+ const {
6386
+ type: type2 = "button",
6387
+ glow = true,
6388
+ className,
6389
+ contentClassName,
6390
+ labelClassName,
6391
+ accessibilityLabel,
6392
+ accessibilityRole,
6393
+ testID,
6394
+ onClick,
6395
+ onMouseMove
6396
+ } = props;
6397
+ const model = useButton(props);
6398
+ const localRef = useRef(null);
6399
+ const setRef = (node2) => {
6400
+ localRef.current = node2;
6401
+ if (typeof ref === "function") ref(node2);
6402
+ else if (ref) ref.current = node2;
6403
+ };
6404
+ const handleMouseMove = (e) => {
6405
+ const btn = localRef.current;
6406
+ if (btn && glow) {
6407
+ const rect = btn.getBoundingClientRect();
6408
+ btn.style.setProperty("--glow-x", `${e.clientX - rect.left}px`);
6409
+ btn.style.setProperty("--glow-y", `${e.clientY - rect.top}px`);
6410
+ }
6411
+ onMouseMove?.(e);
6412
+ };
6413
+ const handleClick = (e) => {
6414
+ onClick?.(e);
6415
+ if (!e.defaultPrevented) model.onPress?.();
6416
+ };
6417
+ const iconGroup = /* @__PURE__ */ jsxs(Fragment, { children: [
6418
+ model.loading && /* @__PURE__ */ jsx(AiOutlineLoading, { className: "animate-spin z-10" }),
6419
+ model.icon && /* @__PURE__ */ jsx(
6420
+ "span",
6421
+ {
6422
+ className: cn(
6423
+ "z-10 inline-flex shrink-0 items-center justify-center leading-none",
6424
+ contentClassName
6425
+ ),
6426
+ style: {
6427
+ height: model.iconSize,
6428
+ width: model.iconSize,
6429
+ lineHeight: 0
6430
+ },
6431
+ children: model.icon
6432
+ }
6433
+ )
6434
+ ] });
6435
+ const labelNode = model.label != null && model.label !== "" ? /* @__PURE__ */ jsx(
6407
6436
  "span",
6408
6437
  {
6409
6438
  className: cn(
6410
- "z-10 inline-flex shrink-0 items-center justify-center leading-none",
6411
- contentClassName
6439
+ "z-10 inline-flex items-center justify-center leading-none",
6440
+ labelClassName
6412
6441
  ),
6413
- style: { height: model.iconSize, width: model.iconSize, lineHeight: 0 },
6414
- children: model.icon
6442
+ style: { minHeight: model.iconSize },
6443
+ children: model.label
6415
6444
  }
6416
- )
6417
- ] });
6418
- const labelNode = model.label != null && model.label !== "" ? /* @__PURE__ */ jsx(
6419
- "span",
6420
- {
6421
- className: cn(
6422
- "z-10 inline-flex items-center justify-center leading-none",
6423
- labelClassName
6424
- ),
6425
- style: { minHeight: model.iconSize },
6426
- children: model.label
6427
- }
6428
- ) : null;
6429
- const trailing = model.iconPosition === "trailing";
6430
- return /* @__PURE__ */ jsxs(
6431
- "button",
6432
- {
6433
- ...model.rootRest,
6434
- ref: setRef,
6435
- type: type2,
6436
- disabled: model.isBusy,
6437
- onClick: handleClick,
6438
- onMouseMove: handleMouseMove,
6439
- "aria-disabled": model.isBusy,
6440
- "aria-label": accessibilityLabel,
6441
- "aria-pressed": model.selected,
6442
- "data-testid": testID,
6443
- role: accessibilityRole,
6444
- className: cn(
6445
- WEB_ROOT,
6446
- model.variantClassName,
6447
- model.shapeClassName,
6448
- model.tokens.padding,
6449
- model.tokens.text,
6450
- model.block && "w-full",
6451
- model.isTextMode && buttonTextModeClassName,
6452
- model.isBusy ? "brightness-75 grayscale cursor-not-allowed" : "hover:cursor-pointer",
6453
- className
6454
- ),
6455
- children: [
6456
- glow && /* @__PURE__ */ jsx(
6457
- "span",
6458
- {
6459
- className: "pointer-events-none absolute inset-0 opacity-0 group-hover:opacity-100 transition-opacity duration-300",
6460
- style: {
6461
- background: "radial-gradient(200px circle at var(--glow-x) var(--glow-y), rgba(255,255,255,0.18), transparent 50%)"
6462
- }
6463
- }
6445
+ ) : null;
6446
+ const trailing = model.iconPosition === "trailing";
6447
+ return /* @__PURE__ */ jsxs(
6448
+ "button",
6449
+ {
6450
+ ...model.rootRest,
6451
+ ref: setRef,
6452
+ type: type2,
6453
+ disabled: model.isBusy,
6454
+ onClick: handleClick,
6455
+ onMouseMove: handleMouseMove,
6456
+ "aria-disabled": model.isBusy,
6457
+ "aria-label": accessibilityLabel,
6458
+ "aria-pressed": model.selected,
6459
+ "data-testid": testID,
6460
+ role: accessibilityRole,
6461
+ className: cn(
6462
+ WEB_ROOT,
6463
+ model.variantClassName,
6464
+ model.shapeClassName,
6465
+ model.tokens.padding,
6466
+ model.tokens.text,
6467
+ model.block && "w-full",
6468
+ model.isTextMode && buttonTextModeClassName,
6469
+ model.isBusy ? "brightness-75 grayscale cursor-not-allowed" : "hover:cursor-pointer",
6470
+ className
6464
6471
  ),
6465
- trailing ? labelNode : iconGroup,
6466
- trailing ? iconGroup : labelNode
6467
- ]
6468
- }
6469
- );
6470
- });
6472
+ children: [
6473
+ glow && /* @__PURE__ */ jsx(
6474
+ "span",
6475
+ {
6476
+ className: "pointer-events-none absolute inset-0 opacity-0 group-hover:opacity-100 transition-opacity duration-300",
6477
+ style: {
6478
+ background: "radial-gradient(200px circle at var(--glow-x) var(--glow-y), rgba(255,255,255,0.18), transparent 50%)"
6479
+ }
6480
+ }
6481
+ ),
6482
+ trailing ? labelNode : iconGroup,
6483
+ trailing ? iconGroup : labelNode
6484
+ ]
6485
+ }
6486
+ );
6487
+ }
6488
+ );
6471
6489
  var Button_web_default = Button;
6472
6490
 
6473
6491
  // src/data/styles/shared.styles.tsx
@@ -33186,6 +33204,10 @@ var TopNav = ({
33186
33204
  }
33187
33205
  );
33188
33206
  };
33207
+ var RECOMMENDATION_OPTIONS = [
33208
+ { label: "Yes", value: "yes" },
33209
+ { label: "No", value: "no" }
33210
+ ];
33189
33211
  function ReviewForm({
33190
33212
  initialValues,
33191
33213
  placeholder = "Write your review...",
@@ -33193,163 +33215,85 @@ function ReviewForm({
33193
33215
  cancelLabel = "Cancel",
33194
33216
  loading = false,
33195
33217
  disabled = false,
33196
- autoFocus = false,
33197
33218
  config,
33198
33219
  onSubmit,
33199
33220
  onCancel
33200
33221
  }) {
33201
- const [content3, setContent] = useState(initialValues?.content ?? "");
33202
- const [rating, setRating] = useState(initialValues?.rating ?? 0);
33203
- const [isRecommended, setIsRecommended] = useState(
33204
- initialValues?.isRecommended ?? true
33205
- );
33206
- const [error, setError] = useState("");
33207
- const contentLength = content3.trim().length;
33208
- const ratingItems = useMemo(() => {
33209
- return Array.from(
33210
- {
33211
- length: config.maxRating
33212
- },
33213
- (_2, index3) => index3 + 1
33214
- );
33215
- }, [config.maxRating]);
33216
- useEffect(() => {
33217
- setContent(initialValues?.content ?? "");
33218
- setRating(initialValues?.rating ?? 0);
33219
- setIsRecommended(initialValues?.isRecommended ?? true);
33220
- setError("");
33221
- }, [
33222
- initialValues?.content,
33223
- initialValues?.rating,
33224
- initialValues?.isRecommended
33225
- ]);
33226
- function validate() {
33227
- const trimmedContent = content3.trim();
33228
- if (trimmedContent.length < config.minContentLength) {
33229
- return `Review must be at least ${config.minContentLength} characters.`;
33230
- }
33231
- if (trimmedContent.length > config.maxContentLength) {
33232
- return `Review cannot be more than ${config.maxContentLength} characters.`;
33233
- }
33234
- if (rating < config.minRating) {
33235
- return "Please select a rating.";
33236
- }
33237
- return "";
33238
- }
33239
- async function handleSubmit() {
33240
- const nextError = validate();
33241
- if (nextError) {
33242
- setError(nextError);
33243
- return;
33244
- }
33245
- const values = {
33246
- content: content3.trim(),
33247
- rating,
33248
- isRecommended: config.allowRecommendation ? isRecommended : void 0
33222
+ const formInitialValues = {
33223
+ content: initialValues?.content ?? "",
33224
+ rating: initialValues?.rating ?? 0,
33225
+ isRecommended: initialValues?.isRecommended ?? true ? "yes" : "no"
33226
+ };
33227
+ async function handleSubmit(values) {
33228
+ const normalized = {
33229
+ content: values.content.trim(),
33230
+ rating: Number(values.rating),
33231
+ isRecommended: config.allowRecommendation ? values.isRecommended === "yes" : void 0
33249
33232
  };
33250
- await onSubmit(values);
33233
+ await onSubmit(normalized);
33251
33234
  }
33252
- return /* @__PURE__ */ jsxs("div", { className: "flex flex-col gap-4", children: [
33253
- /* @__PURE__ */ jsx(
33254
- "textarea",
33255
- {
33256
- value: content3,
33257
- disabled: disabled || loading,
33258
- autoFocus,
33259
- placeholder,
33260
- maxLength: config.maxContentLength,
33261
- onChange: (event) => {
33262
- setContent(event.target.value);
33263
- setError("");
33264
- },
33265
- 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"
33266
- }
33267
- ),
33268
- /* @__PURE__ */ jsxs("div", { className: "flex items-center justify-between gap-3 text-xs text-gray-500 dark:text-gray-400", children: [
33269
- /* @__PURE__ */ jsxs("span", { children: [
33270
- contentLength,
33271
- "/",
33272
- config.maxContentLength
33273
- ] }),
33274
- error && /* @__PURE__ */ jsx("span", { className: "text-red-500", children: error })
33275
- ] }),
33276
- /* @__PURE__ */ jsxs("div", { className: "flex flex-col gap-2", children: [
33277
- /* @__PURE__ */ jsx("span", { className: "text-sm font-medium text-gray-700 dark:text-gray-300", children: "Rating" }),
33278
- /* @__PURE__ */ jsx("div", { className: "flex items-center gap-1", children: ratingItems.map((item) => {
33279
- const active = item <= rating;
33280
- return /* @__PURE__ */ jsx(
33281
- "button",
33282
- {
33283
- type: "button",
33284
- disabled: disabled || loading,
33285
- onClick: () => {
33286
- setRating(item);
33287
- setError("");
33288
- },
33289
- className: `
33290
- text-2xl leading-none transition-transform disabled:cursor-not-allowed disabled:opacity-60
33291
- ${active ? "text-yellow-400" : "text-gray-300 dark:text-neutral-700"}
33292
- hover:scale-110
33293
- `,
33294
- "aria-label": `Rate ${item} out of ${config.maxRating}`,
33295
- children: "\u2605"
33296
- },
33297
- item
33298
- );
33299
- }) })
33300
- ] }),
33301
- config.allowRecommendation && /* @__PURE__ */ jsxs("div", { className: "flex flex-col gap-2", children: [
33302
- /* @__PURE__ */ jsx("span", { className: "text-sm font-medium text-gray-700 dark:text-gray-300", children: "Do you recommend this?" }),
33303
- /* @__PURE__ */ jsxs("div", { className: "flex flex-wrap gap-3", children: [
33304
- /* @__PURE__ */ jsxs("label", { className: "inline-flex cursor-pointer items-center gap-2 text-sm text-gray-700 dark:text-gray-300", children: [
33235
+ return /* @__PURE__ */ jsx(
33236
+ Form,
33237
+ {
33238
+ enableReinitialize: true,
33239
+ initialValues: formInitialValues,
33240
+ onSubmit: handleSubmit,
33241
+ children: (formik) => {
33242
+ const content3 = String(formik.values.content ?? "").trim();
33243
+ const rating = Number(formik.values.rating ?? 0);
33244
+ const isValid = content3.length >= config.minContentLength && rating >= config.minRating;
33245
+ const busy = loading || formik.isSubmitting;
33246
+ return /* @__PURE__ */ jsxs("div", { className: "flex flex-col gap-4", children: [
33305
33247
  /* @__PURE__ */ jsx(
33306
- "input",
33248
+ TextArea,
33307
33249
  {
33308
- type: "radio",
33309
- checked: isRecommended,
33310
- disabled: disabled || loading,
33311
- onChange: () => setIsRecommended(true)
33250
+ name: "content",
33251
+ label: placeholder,
33252
+ placeholder,
33253
+ rows: 4,
33254
+ limit: config.maxContentLength,
33255
+ disabled: disabled || busy
33312
33256
  }
33313
33257
  ),
33314
- "Yes"
33315
- ] }),
33316
- /* @__PURE__ */ jsxs("label", { className: "inline-flex cursor-pointer items-center gap-2 text-sm text-gray-700 dark:text-gray-300", children: [
33317
- /* @__PURE__ */ jsx(
33318
- "input",
33258
+ /* @__PURE__ */ jsxs("div", { className: "flex flex-col gap-2", children: [
33259
+ /* @__PURE__ */ jsx("span", { className: "text-sm font-medium text-gray-700 dark:text-gray-300", children: "Rating" }),
33260
+ /* @__PURE__ */ jsx(StarRatingInput_default, { name: "rating", starAmount: config.maxRating })
33261
+ ] }),
33262
+ config.allowRecommendation && /* @__PURE__ */ jsx(
33263
+ Radio_default,
33319
33264
  {
33320
- type: "radio",
33321
- checked: !isRecommended,
33322
- disabled: disabled || loading,
33323
- onChange: () => setIsRecommended(false)
33265
+ name: "isRecommended",
33266
+ placeholder: "Do you recommend this?",
33267
+ options: RECOMMENDATION_OPTIONS
33324
33268
  }
33325
33269
  ),
33326
- "No"
33327
- ] })
33328
- ] })
33329
- ] }),
33330
- /* @__PURE__ */ jsxs("div", { className: "flex justify-end gap-2", children: [
33331
- onCancel && /* @__PURE__ */ jsx(
33332
- Button_web_default,
33333
- {
33334
- text: cancelLabel,
33335
- variant: "secondary",
33336
- appearance: "ghost",
33337
- disabled: loading,
33338
- onClick: onCancel
33339
- }
33340
- ),
33341
- /* @__PURE__ */ jsx(
33342
- Button_web_default,
33343
- {
33344
- text: submitLabel,
33345
- variant: "primary",
33346
- loading,
33347
- disabled: disabled || !content3.trim() || rating < config.minRating,
33348
- onClick: handleSubmit
33349
- }
33350
- )
33351
- ] })
33352
- ] });
33270
+ /* @__PURE__ */ jsxs("div", { className: "flex justify-end gap-2", children: [
33271
+ onCancel && /* @__PURE__ */ jsx(
33272
+ Button_web_default,
33273
+ {
33274
+ type: "button",
33275
+ text: cancelLabel,
33276
+ variant: "secondary",
33277
+ appearance: "ghost",
33278
+ disabled: busy,
33279
+ onClick: onCancel
33280
+ }
33281
+ ),
33282
+ /* @__PURE__ */ jsx(
33283
+ Button_web_default,
33284
+ {
33285
+ type: "submit",
33286
+ text: submitLabel,
33287
+ variant: "primary",
33288
+ loading: busy,
33289
+ disabled: disabled || !isValid
33290
+ }
33291
+ )
33292
+ ] })
33293
+ ] });
33294
+ }
33295
+ }
33296
+ );
33353
33297
  }
33354
33298
  var ReviewForm_default = ReviewForm;
33355
33299
  function ReviewComposer({
@@ -33363,12 +33307,12 @@ function ReviewComposer({
33363
33307
  onSubmit
33364
33308
  }) {
33365
33309
  if (!currentUser) {
33366
- return /* @__PURE__ */ jsx("div", { className: "rounded-xl border border-gray-200 bg-white p-4 dark:border-neutral-800 dark:bg-neutral-900", children: /* @__PURE__ */ jsxs("div", { className: "flex flex-wrap items-center justify-between gap-3", children: [
33367
- /* @__PURE__ */ jsx("p", { className: "text-sm text-gray-600 dark:text-gray-400", children: "Please login to post your review." }),
33310
+ return /* @__PURE__ */ jsx(Card_default, { styles: "p-4", children: /* @__PURE__ */ jsxs("div", { className: "flex flex-wrap items-center justify-between gap-3", children: [
33311
+ /* @__PURE__ */ jsx(Typography.Caption, { children: "Please login to post your review." }),
33368
33312
  onLoginClick && /* @__PURE__ */ jsx(Button_web_default, { text: "Login", variant: "primary", onClick: onLoginClick })
33369
33313
  ] }) });
33370
33314
  }
33371
- return /* @__PURE__ */ jsx("div", { className: "rounded-xl border border-gray-200 bg-white p-4 dark:border-neutral-800 dark:bg-neutral-900", children: /* @__PURE__ */ jsxs("div", { className: "flex gap-4", children: [
33315
+ return /* @__PURE__ */ jsx(Card_default, { styles: "p-4", children: /* @__PURE__ */ jsxs("div", { className: "flex gap-4", children: [
33372
33316
  /* @__PURE__ */ jsx(Avatar, { src: currentUser.avatar, size: "md" }),
33373
33317
  /* @__PURE__ */ jsx("div", { className: "min-w-0 flex-1", children: /* @__PURE__ */ jsx(
33374
33318
  ReviewForm_default,
@@ -33598,48 +33542,23 @@ function ReviewHeader({ review, config }) {
33598
33542
  }
33599
33543
  var ReviewHeader_default = ReviewHeader;
33600
33544
  function ReviewContent({ review }) {
33601
- return /* @__PURE__ */ jsx("div", { className: "whitespace-pre-wrap break-words text-sm leading-6 text-gray-700 dark:text-gray-300", children: review.content });
33545
+ return /* @__PURE__ */ jsx(Typography.Paragraph, { className: "whitespace-pre-wrap break-words", children: review.content });
33602
33546
  }
33603
33547
  var ReviewContent_default = ReviewContent;
33604
33548
  function ReviewRating({ rating, maxRating }) {
33605
- const items = Array.from(
33606
- {
33607
- length: maxRating
33608
- },
33609
- (_2, index3) => index3 + 1
33610
- );
33611
- return /* @__PURE__ */ jsx(
33612
- "div",
33613
- {
33614
- className: "inline-flex items-center gap-0.5",
33615
- "aria-label": `${rating} out of ${maxRating}`,
33616
- children: items.map((item) => /* @__PURE__ */ jsx(
33617
- "span",
33618
- {
33619
- className: item <= rating ? "text-sm text-yellow-400" : "text-sm text-gray-300 dark:text-neutral-700",
33620
- children: "\u2605"
33621
- },
33622
- item
33623
- ))
33624
- }
33625
- );
33549
+ return /* @__PURE__ */ jsx(StarRating, { rating, max: maxRating, size: "sm" });
33626
33550
  }
33627
33551
  var ReviewRating_default = ReviewRating;
33628
33552
  function ReviewRecommendation({ isRecommended }) {
33629
33553
  if (typeof isRecommended !== "boolean") {
33630
33554
  return null;
33631
33555
  }
33632
- return /* @__PURE__ */ jsxs(
33633
- "span",
33556
+ return /* @__PURE__ */ jsx(
33557
+ Chip,
33634
33558
  {
33635
- className: `
33636
- inline-flex items-center gap-1 rounded-full px-2.5 py-1 text-xs font-medium
33637
- ${isRecommended ? "bg-green-500/10 text-green-500" : "bg-red-500/10 text-red-500"}
33638
- `,
33639
- children: [
33640
- isRecommended ? /* @__PURE__ */ jsx(BiCheckCircle, { size: 16 }) : /* @__PURE__ */ jsx(BiXCircle, { size: 16 }),
33641
- isRecommended ? "Recommended" : "Not Recommended"
33642
- ]
33559
+ label: isRecommended ? "Recommended" : "Not Recommended",
33560
+ variant: isRecommended ? "success" : "danger",
33561
+ appearance: "lite"
33643
33562
  }
33644
33563
  );
33645
33564
  }
@@ -33777,56 +33696,32 @@ function MyReviewPanel({
33777
33696
  ] });
33778
33697
  }
33779
33698
  var MyReviewPanel_default = MyReviewPanel;
33780
- function ReviewMenuItem({
33781
- icon,
33782
- name: name2,
33783
- badge,
33784
- to,
33785
- navigate,
33786
- className,
33787
- onClick,
33788
- style: style2
33789
- }) {
33790
- return /* @__PURE__ */ jsx(
33791
- MenuItem,
33792
- {
33793
- icon,
33794
- name: name2,
33795
- badge,
33796
- to,
33797
- navigate,
33798
- onClick,
33799
- style: style2,
33800
- className
33801
- }
33802
- );
33803
- }
33699
+ 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";
33804
33700
  function ReviewMenu({
33805
33701
  open,
33806
33702
  setOpen,
33807
33703
  canEdit,
33808
33704
  canDelete,
33809
33705
  canReport,
33810
- canReply,
33811
33706
  onEdit,
33812
33707
  onDelete,
33813
- onReport,
33814
- onReply
33708
+ onReport
33815
33709
  }) {
33816
33710
  const ref = useRef(null);
33817
33711
  useClickOutside(ref, () => setOpen(false));
33712
+ const withClose = (action) => () => {
33713
+ setOpen(false);
33714
+ action?.();
33715
+ };
33818
33716
  const items = [];
33819
33717
  if (canEdit) {
33820
33718
  items.push({
33821
33719
  type: "item",
33822
33720
  icon: /* @__PURE__ */ jsx(BiEdit, {}),
33823
33721
  name: "Edit Review",
33824
- component: ReviewMenuItem,
33825
- onClick: () => {
33826
- setOpen(false);
33827
- onEdit?.();
33828
- },
33829
- className: "flex w-full items-center gap-2 px-4 py-3 text-sm hover:bg-gray-100 dark:hover:bg-neutral-800"
33722
+ component: MenuItem,
33723
+ onClick: withClose(onEdit),
33724
+ className: MENU_ITEM_CLASS
33830
33725
  });
33831
33726
  }
33832
33727
  if (canDelete) {
@@ -33834,12 +33729,9 @@ function ReviewMenu({
33834
33729
  type: "item",
33835
33730
  icon: /* @__PURE__ */ jsx(BiTrash, {}),
33836
33731
  name: "Delete Review",
33837
- component: ReviewMenuItem,
33838
- onClick: () => {
33839
- setOpen(false);
33840
- onDelete?.();
33841
- },
33842
- 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"
33732
+ component: MenuItem,
33733
+ onClick: withClose(onDelete),
33734
+ className: `${MENU_ITEM_CLASS} text-red-500`
33843
33735
  });
33844
33736
  }
33845
33737
  if (canReport) {
@@ -33847,25 +33739,9 @@ function ReviewMenu({
33847
33739
  type: "item",
33848
33740
  icon: /* @__PURE__ */ jsx(BiFlag, {}),
33849
33741
  name: "Report Review",
33850
- component: ReviewMenuItem,
33851
- onClick: () => {
33852
- setOpen(false);
33853
- onReport?.();
33854
- },
33855
- className: "flex w-full items-center gap-2 px-4 py-3 text-sm hover:bg-gray-100 dark:hover:bg-neutral-800"
33856
- });
33857
- }
33858
- if (canReply) {
33859
- items.push({
33860
- type: "item",
33861
- icon: /* @__PURE__ */ jsx(BiReply, {}),
33862
- name: "Reply as Owner",
33863
- component: ReviewMenuItem,
33864
- onClick: () => {
33865
- setOpen(false);
33866
- onReply?.();
33867
- },
33868
- className: "flex w-full items-center gap-2 px-4 py-3 text-sm hover:bg-gray-100 dark:hover:bg-neutral-800"
33742
+ component: MenuItem,
33743
+ onClick: withClose(onReport),
33744
+ className: MENU_ITEM_CLASS
33869
33745
  });
33870
33746
  }
33871
33747
  if (!items.length) {
@@ -33886,20 +33762,20 @@ function ReviewMenu({
33886
33762
  ] });
33887
33763
  }
33888
33764
  var ReviewMenu_default = ReviewMenu;
33889
- function ReviewActions({ canReply, onReply }) {
33765
+ function ReviewActions({ canReply, config, onReply }) {
33890
33766
  if (!canReply) {
33891
33767
  return null;
33892
33768
  }
33893
- return /* @__PURE__ */ jsx("div", { className: "flex items-center gap-4 text-sm text-gray-500 dark:text-gray-400", children: /* @__PURE__ */ jsxs(
33894
- "button",
33769
+ return /* @__PURE__ */ jsx("div", { children: /* @__PURE__ */ jsx(
33770
+ Button_web_default,
33895
33771
  {
33896
33772
  type: "button",
33897
- onClick: onReply,
33898
- className: "inline-flex items-center gap-1 font-medium transition-colors hover:text-gray-900 dark:hover:text-gray-100",
33899
- children: [
33900
- /* @__PURE__ */ jsx(BiReply, { size: 18 }),
33901
- "Reply as Owner"
33902
- ]
33773
+ text: `Reply as ${config.ownerReplyLabel}`,
33774
+ variant: "secondary",
33775
+ appearance: "ghost",
33776
+ size: "sm",
33777
+ icon: /* @__PURE__ */ jsx(BiReply, {}),
33778
+ onClick: onReply
33903
33779
  }
33904
33780
  ) });
33905
33781
  }
@@ -33927,33 +33803,10 @@ function ReviewReplyHeader({ reply, config }) {
33927
33803
  }
33928
33804
  var ReviewReplyHeader_default = ReviewReplyHeader;
33929
33805
  function ReviewReplyContent({ reply }) {
33930
- return /* @__PURE__ */ jsx("div", { className: "whitespace-pre-wrap break-words text-sm leading-6 text-gray-700 dark:text-gray-300", children: reply.content });
33806
+ return /* @__PURE__ */ jsx(Typography.Paragraph, { className: "whitespace-pre-wrap break-words", children: reply.content });
33931
33807
  }
33932
33808
  var ReviewReplyContent_default = ReviewReplyContent;
33933
- function ReviewReplyMenuItem({
33934
- icon,
33935
- name: name2,
33936
- badge,
33937
- to,
33938
- navigate,
33939
- className,
33940
- onClick,
33941
- style: style2
33942
- }) {
33943
- return /* @__PURE__ */ jsx(
33944
- MenuItem,
33945
- {
33946
- icon,
33947
- name: name2,
33948
- badge,
33949
- to,
33950
- navigate,
33951
- onClick,
33952
- style: style2,
33953
- className
33954
- }
33955
- );
33956
- }
33809
+ 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";
33957
33810
  function ReviewReplyMenu({
33958
33811
  open,
33959
33812
  setOpen,
@@ -33966,18 +33819,19 @@ function ReviewReplyMenu({
33966
33819
  }) {
33967
33820
  const ref = useRef(null);
33968
33821
  useClickOutside(ref, () => setOpen(false));
33822
+ const withClose = (action) => () => {
33823
+ setOpen(false);
33824
+ action?.();
33825
+ };
33969
33826
  const items = [];
33970
33827
  if (canEdit) {
33971
33828
  items.push({
33972
33829
  type: "item",
33973
33830
  icon: /* @__PURE__ */ jsx(BiEdit, {}),
33974
33831
  name: "Edit Reply",
33975
- component: ReviewReplyMenuItem,
33976
- onClick: () => {
33977
- setOpen(false);
33978
- onEdit?.();
33979
- },
33980
- className: "flex w-full items-center gap-2 px-4 py-3 text-sm hover:bg-gray-100 dark:hover:bg-neutral-800"
33832
+ component: MenuItem,
33833
+ onClick: withClose(onEdit),
33834
+ className: MENU_ITEM_CLASS2
33981
33835
  });
33982
33836
  }
33983
33837
  if (canDelete) {
@@ -33985,12 +33839,9 @@ function ReviewReplyMenu({
33985
33839
  type: "item",
33986
33840
  icon: /* @__PURE__ */ jsx(BiTrash, {}),
33987
33841
  name: "Delete Reply",
33988
- component: ReviewReplyMenuItem,
33989
- onClick: () => {
33990
- setOpen(false);
33991
- onDelete?.();
33992
- },
33993
- 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"
33842
+ component: MenuItem,
33843
+ onClick: withClose(onDelete),
33844
+ className: `${MENU_ITEM_CLASS2} text-red-500`
33994
33845
  });
33995
33846
  }
33996
33847
  if (canReport) {
@@ -33998,12 +33849,9 @@ function ReviewReplyMenu({
33998
33849
  type: "item",
33999
33850
  icon: /* @__PURE__ */ jsx(BiFlag, {}),
34000
33851
  name: "Report Reply",
34001
- component: ReviewReplyMenuItem,
34002
- onClick: () => {
34003
- setOpen(false);
34004
- onReport?.();
34005
- },
34006
- className: "flex w-full items-center gap-2 px-4 py-3 text-sm hover:bg-gray-100 dark:hover:bg-neutral-800"
33852
+ component: MenuItem,
33853
+ onClick: withClose(onReport),
33854
+ className: MENU_ITEM_CLASS2
34007
33855
  });
34008
33856
  }
34009
33857
  if (!items.length) {
@@ -34135,11 +33983,9 @@ function ReviewItem({
34135
33983
  canEdit,
34136
33984
  canDelete,
34137
33985
  canReport,
34138
- canReply,
34139
33986
  onEdit: () => onEditReview?.(review),
34140
33987
  onDelete: () => onDeleteReview?.(review),
34141
- onReport: () => onReportReview?.(review),
34142
- onReply: () => onReplyToReview?.(review)
33988
+ onReport: () => onReportReview?.(review)
34143
33989
  }
34144
33990
  )
34145
33991
  ] }),
@@ -34158,6 +34004,7 @@ function ReviewItem({
34158
34004
  ActionsComponent,
34159
34005
  {
34160
34006
  review,
34007
+ config,
34161
34008
  canReply,
34162
34009
  onReply: () => onReplyToReview?.(review)
34163
34010
  }
@@ -34181,9 +34028,9 @@ function ReviewEmptyState({
34181
34028
  title = "No reviews yet",
34182
34029
  text: text10 = "There are no reviews to show."
34183
34030
  }) {
34184
- return /* @__PURE__ */ 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: [
34185
- /* @__PURE__ */ jsx("div", { className: "text-sm font-semibold text-gray-900 dark:text-gray-100", children: title }),
34186
- text10 && /* @__PURE__ */ jsx("p", { className: "mt-2 text-sm text-gray-500 dark:text-gray-400", children: text10 })
34031
+ return /* @__PURE__ */ jsxs(Info, { className: "flex flex-col items-center gap-1 text-center", children: [
34032
+ /* @__PURE__ */ jsx(Typography.Label, { bold: true, children: title }),
34033
+ text10 && /* @__PURE__ */ jsx(Typography.Caption, { children: text10 })
34187
34034
  ] });
34188
34035
  }
34189
34036
  var ReviewEmptyState_default = ReviewEmptyState;
@@ -35536,11 +35383,11 @@ function addChildren(props, children3) {
35536
35383
  }
35537
35384
  }
35538
35385
  }
35539
- function productionCreate(_2, jsx256, jsxs129) {
35386
+ function productionCreate(_2, jsx256, jsxs127) {
35540
35387
  return create3;
35541
35388
  function create3(_3, type2, props, key) {
35542
35389
  const isStaticChildren = Array.isArray(props.children);
35543
- const fn = isStaticChildren ? jsxs129 : jsx256;
35390
+ const fn = isStaticChildren ? jsxs127 : jsx256;
35544
35391
  return key ? fn(type2, props, key) : fn(type2, props);
35545
35392
  }
35546
35393
  }