@agentiffai/design 1.4.9 → 1.5.1

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.cjs CHANGED
@@ -9284,6 +9284,39 @@ function WhatsAppIcon({
9284
9284
  );
9285
9285
  }
9286
9286
  WhatsAppIcon.displayName = "WhatsAppIcon";
9287
+ var COLORS = {
9288
+ colored: { bg: "#F22F46", dot: "#FFFFFF" },
9289
+ black: { bg: "#111111", dot: "#FFFFFF" },
9290
+ white: { bg: "#FFFFFF", dot: "#111111" }
9291
+ };
9292
+ function TwilioIcon({
9293
+ size = 24,
9294
+ variant = "colored",
9295
+ "aria-label": ariaLabel = "Twilio",
9296
+ ...props
9297
+ }) {
9298
+ const colors = COLORS[variant];
9299
+ return /* @__PURE__ */ jsxRuntime.jsxs(
9300
+ "svg",
9301
+ {
9302
+ width: size,
9303
+ height: size,
9304
+ viewBox: "0 0 24 24",
9305
+ role: props["aria-hidden"] ? void 0 : "img",
9306
+ "aria-label": props["aria-hidden"] ? void 0 : ariaLabel,
9307
+ xmlns: "http://www.w3.org/2000/svg",
9308
+ ...props,
9309
+ children: [
9310
+ /* @__PURE__ */ jsxRuntime.jsx("circle", { cx: "12", cy: "12", r: "11", fill: colors.bg }),
9311
+ /* @__PURE__ */ jsxRuntime.jsx("circle", { cx: "8.25", cy: "8.25", r: "2.1", fill: colors.dot }),
9312
+ /* @__PURE__ */ jsxRuntime.jsx("circle", { cx: "15.75", cy: "8.25", r: "2.1", fill: colors.dot }),
9313
+ /* @__PURE__ */ jsxRuntime.jsx("circle", { cx: "8.25", cy: "15.75", r: "2.1", fill: colors.dot }),
9314
+ /* @__PURE__ */ jsxRuntime.jsx("circle", { cx: "15.75", cy: "15.75", r: "2.1", fill: colors.dot })
9315
+ ]
9316
+ }
9317
+ );
9318
+ }
9319
+ TwilioIcon.displayName = "TwilioIcon";
9287
9320
  var StyledXIcon = styled58__default.default.svg`
9288
9321
  display: inline-block;
9289
9322
  vertical-align: middle;
@@ -9911,13 +9944,17 @@ var PostPreviewCard = ({
9911
9944
  isEditing = false,
9912
9945
  editContent,
9913
9946
  onContentChange,
9947
+ editHashtags,
9948
+ onHashtagsChange,
9914
9949
  isLoading = false,
9915
9950
  onImageChange
9916
9951
  }) => {
9917
9952
  const platformConfig = PLATFORM_CONFIGS[post.platform] || PLATFORM_CONFIGS.x;
9918
9953
  const [imageError, setImageError] = React4.useState(false);
9954
+ const [newHashtag, setNewHashtag] = React4.useState("");
9919
9955
  const showSkeleton = isLoading && !post.content;
9920
9956
  const displayContent = isEditing && editContent !== void 0 ? editContent : post.editedContent || post.content;
9957
+ const displayHashtags = isEditing && editHashtags !== void 0 ? editHashtags : post.hashtags;
9921
9958
  const currentCharCount = displayContent.length;
9922
9959
  const charPercentage = React4.useMemo(
9923
9960
  () => getCharacterLimitPercentage(post.platform, currentCharCount),
@@ -9931,6 +9968,32 @@ var PostPreviewCard = ({
9931
9968
  const handleContentChange = (e) => {
9932
9969
  onContentChange?.(e.target.value);
9933
9970
  };
9971
+ const normalizeHashtag = (value) => value.trim().replace(/^#+/, "").replace(/[^\p{L}\p{N}_]/gu, "");
9972
+ const handleRemoveHashtag = (hashtagToRemove) => {
9973
+ const normalizedToRemove = normalizeHashtag(hashtagToRemove).toLowerCase();
9974
+ onHashtagsChange?.(
9975
+ displayHashtags.filter(
9976
+ (hashtag) => normalizeHashtag(hashtag).toLowerCase() !== normalizedToRemove
9977
+ )
9978
+ );
9979
+ };
9980
+ const handleAddHashtag = () => {
9981
+ const normalized = normalizeHashtag(newHashtag);
9982
+ if (!normalized) return;
9983
+ const exists = displayHashtags.some(
9984
+ (hashtag) => normalizeHashtag(hashtag).toLowerCase() === normalized.toLowerCase()
9985
+ );
9986
+ if (!exists) {
9987
+ onHashtagsChange?.([...displayHashtags, normalized]);
9988
+ }
9989
+ setNewHashtag("");
9990
+ };
9991
+ const handleNewHashtagKeyDown = (e) => {
9992
+ if (e.key === "Enter") {
9993
+ e.preventDefault();
9994
+ handleAddHashtag();
9995
+ }
9996
+ };
9934
9997
  return /* @__PURE__ */ jsxRuntime.jsxs(
9935
9998
  CardContainer,
9936
9999
  {
@@ -9960,10 +10023,45 @@ var PostPreviewCard = ({
9960
10023
  autoFocus: true
9961
10024
  }
9962
10025
  ) : /* @__PURE__ */ jsxRuntime.jsx(PostContent, { children: displayContent }),
9963
- !showSkeleton && post.hashtags.length > 0 && /* @__PURE__ */ jsxRuntime.jsx(HashtagsContainer, { children: post.hashtags.map((hashtag) => /* @__PURE__ */ jsxRuntime.jsxs(HashtagPill, { $platformColor: platformConfig.color, children: [
9964
- "#",
9965
- hashtag.replace(/^#/, "")
9966
- ] }, hashtag)) })
10026
+ !showSkeleton && (displayHashtags.length > 0 || isEditing) && /* @__PURE__ */ jsxRuntime.jsxs(HashtagsContainer, { children: [
10027
+ displayHashtags.map((hashtag) => /* @__PURE__ */ jsxRuntime.jsxs(HashtagPill, { $platformColor: platformConfig.color, children: [
10028
+ "#",
10029
+ hashtag.replace(/^#/, ""),
10030
+ isEditing && onHashtagsChange && /* @__PURE__ */ jsxRuntime.jsx(
10031
+ RemoveHashtagButton,
10032
+ {
10033
+ type: "button",
10034
+ onClick: () => handleRemoveHashtag(hashtag),
10035
+ "aria-label": `Remove #${hashtag.replace(/^#/, "")}`,
10036
+ children: "\xD7"
10037
+ }
10038
+ )
10039
+ ] }, hashtag)),
10040
+ isEditing && onHashtagsChange && /* @__PURE__ */ jsxRuntime.jsxs(HashtagEditor, { children: [
10041
+ /* @__PURE__ */ jsxRuntime.jsxs(HashtagInputWrapper, { children: [
10042
+ /* @__PURE__ */ jsxRuntime.jsx(HashPrefix, { children: "#" }),
10043
+ /* @__PURE__ */ jsxRuntime.jsx(
10044
+ HashtagInput,
10045
+ {
10046
+ value: newHashtag,
10047
+ onChange: (e) => setNewHashtag(e.target.value),
10048
+ onKeyDown: handleNewHashtagKeyDown,
10049
+ placeholder: "Add hashtag",
10050
+ "aria-label": "Add hashtag"
10051
+ }
10052
+ )
10053
+ ] }),
10054
+ /* @__PURE__ */ jsxRuntime.jsx(
10055
+ AddHashtagButton,
10056
+ {
10057
+ type: "button",
10058
+ onClick: handleAddHashtag,
10059
+ disabled: !normalizeHashtag(newHashtag),
10060
+ children: "Add"
10061
+ }
10062
+ )
10063
+ ] })
10064
+ ] })
9967
10065
  ] }),
9968
10066
  post.imageUrl && !imageError ? onImageChange ? /* @__PURE__ */ jsxRuntime.jsx(ImageChangeButton, { type: "button", onClick: onImageChange, "aria-label": "Change image", children: /* @__PURE__ */ jsxRuntime.jsxs(ImagePreviewContainer, { children: [
9969
10067
  /* @__PURE__ */ jsxRuntime.jsx(
@@ -10178,7 +10276,9 @@ var HashtagsContainer = styled58__default.default.div`
10178
10276
  gap: 6px;
10179
10277
  `;
10180
10278
  var HashtagPill = styled58__default.default.span`
10181
- display: inline-block;
10279
+ display: inline-flex;
10280
+ align-items: center;
10281
+ gap: 6px;
10182
10282
  padding: ${tokens.spacing.xs} 10px;
10183
10283
  border-radius: ${tokens.borderRadius.full};
10184
10284
  font-size: ${tokens.typography.fontSize.xs};
@@ -10194,6 +10294,99 @@ var HashtagPill = styled58__default.default.span`
10194
10294
  color: ${tokens.colors.primary};
10195
10295
  }
10196
10296
  `;
10297
+ var RemoveHashtagButton = styled58__default.default.button`
10298
+ width: 16px;
10299
+ height: 16px;
10300
+ display: inline-flex;
10301
+ align-items: center;
10302
+ justify-content: center;
10303
+ padding: 0;
10304
+ border: none;
10305
+ border-radius: ${tokens.borderRadius.full};
10306
+ background: ${tokens.colors.background.light};
10307
+ color: ${tokens.colors.text.secondary};
10308
+ cursor: pointer;
10309
+ font-size: 12px;
10310
+ line-height: 1;
10311
+ transition: all ${tokens.transitions.fast};
10312
+
10313
+ &:hover,
10314
+ &:focus-visible {
10315
+ background: ${tokens.colors.error};
10316
+ color: ${tokens.colors.text.primary};
10317
+ outline: none;
10318
+ }
10319
+ `;
10320
+ var HashtagEditor = styled58__default.default.div`
10321
+ display: inline-flex;
10322
+ align-items: center;
10323
+ gap: ${tokens.spacing.xs};
10324
+ min-width: min(100%, 190px);
10325
+ `;
10326
+ var HashtagInputWrapper = styled58__default.default.div`
10327
+ display: inline-flex;
10328
+ align-items: center;
10329
+ flex: 1;
10330
+ min-width: 0;
10331
+ padding: 0 ${tokens.spacing.sm};
10332
+ border: 1px solid ${tokens.colors.border.default};
10333
+ border-radius: ${tokens.borderRadius.full};
10334
+ background: ${tokens.colors.background.darker};
10335
+ transition: border-color ${tokens.transitions.fast}, box-shadow ${tokens.transitions.fast};
10336
+
10337
+ &:focus-within {
10338
+ border-color: ${tokens.colors.border.focus};
10339
+ box-shadow: 0 0 0 2px ${tokens.colors.primary}20;
10340
+ }
10341
+ `;
10342
+ var HashPrefix = styled58__default.default.span`
10343
+ color: ${tokens.colors.text.tertiary};
10344
+ font-size: ${tokens.typography.fontSize.xs};
10345
+ `;
10346
+ var HashtagInput = styled58__default.default.input`
10347
+ width: 100%;
10348
+ min-width: 0;
10349
+ height: 28px;
10350
+ padding: 0;
10351
+ border: none;
10352
+ background: transparent;
10353
+ color: ${tokens.colors.text.primary};
10354
+ font-size: ${tokens.typography.fontSize.xs};
10355
+ font-family: ${tokens.typography.fontFamily.primary};
10356
+
10357
+ &:focus {
10358
+ outline: none;
10359
+ }
10360
+
10361
+ &::placeholder {
10362
+ color: ${tokens.colors.text.tertiary};
10363
+ }
10364
+ `;
10365
+ var AddHashtagButton = styled58__default.default.button`
10366
+ height: 28px;
10367
+ padding: 0 ${tokens.spacing.sm};
10368
+ border: 1px solid ${tokens.colors.border.default};
10369
+ border-radius: ${tokens.borderRadius.full};
10370
+ background: ${tokens.colors.background.light};
10371
+ color: ${tokens.colors.text.primary};
10372
+ cursor: pointer;
10373
+ font-size: ${tokens.typography.fontSize.xs};
10374
+ font-weight: ${tokens.typography.fontWeight.semibold};
10375
+ transition: all ${tokens.transitions.fast};
10376
+
10377
+ &:hover:not(:disabled),
10378
+ &:focus-visible:not(:disabled) {
10379
+ background: ${tokens.colors.primary};
10380
+ border-color: ${tokens.colors.primary};
10381
+ color: ${tokens.colors.background.dark};
10382
+ outline: none;
10383
+ }
10384
+
10385
+ &:disabled {
10386
+ opacity: 0.45;
10387
+ cursor: not-allowed;
10388
+ }
10389
+ `;
10197
10390
  var ProgressBarContainer2 = styled58__default.default.div`
10198
10391
  margin-top: ${tokens.spacing.sm};
10199
10392
  `;
@@ -10339,6 +10532,8 @@ var PlatformCarousel = ({
10339
10532
  editingIndex,
10340
10533
  editContent,
10341
10534
  onEditContentChange,
10535
+ editHashtags,
10536
+ onEditHashtagsChange,
10342
10537
  isLoading = false,
10343
10538
  onImageChangeRequest
10344
10539
  }) => {
@@ -10400,6 +10595,8 @@ var PlatformCarousel = ({
10400
10595
  isEditing,
10401
10596
  editContent: isEditing ? editContent : void 0,
10402
10597
  onContentChange: isEditing ? onEditContentChange : void 0,
10598
+ editHashtags: isEditing ? editHashtags : void 0,
10599
+ onHashtagsChange: isEditing ? onEditHashtagsChange : void 0,
10403
10600
  isLoading,
10404
10601
  onImageChange: onImageChangeRequest ? () => onImageChangeRequest(index) : void 0
10405
10602
  }
@@ -10530,6 +10727,8 @@ var PlatformGrid = ({
10530
10727
  editingIndex,
10531
10728
  editContent,
10532
10729
  onEditContentChange,
10730
+ editHashtags,
10731
+ onEditHashtagsChange,
10533
10732
  isLoading = false,
10534
10733
  activeIndex = 0,
10535
10734
  onActiveChange,
@@ -10570,6 +10769,8 @@ var PlatformGrid = ({
10570
10769
  isEditing,
10571
10770
  editContent: isEditing ? editContent : void 0,
10572
10771
  onContentChange: isEditing ? onEditContentChange : void 0,
10772
+ editHashtags: isEditing ? editHashtags : void 0,
10773
+ onHashtagsChange: isEditing ? onEditHashtagsChange : void 0,
10573
10774
  isLoading,
10574
10775
  onImageChange: onImageChangeRequest ? () => onImageChangeRequest(index) : void 0
10575
10776
  }
@@ -10764,6 +10965,8 @@ var SocialMediaCanvas = ({
10764
10965
  editingIndex,
10765
10966
  editContent,
10766
10967
  onEditContentChange,
10968
+ editHashtags,
10969
+ onEditHashtagsChange,
10767
10970
  isLoading = false,
10768
10971
  activeIndex = 0,
10769
10972
  onImageChangeRequest
@@ -10823,6 +11026,8 @@ var SocialMediaCanvas = ({
10823
11026
  editingIndex,
10824
11027
  editContent,
10825
11028
  onEditContentChange,
11029
+ editHashtags,
11030
+ onEditHashtagsChange,
10826
11031
  isLoading,
10827
11032
  onImageChangeRequest
10828
11033
  }
@@ -10833,6 +11038,8 @@ var SocialMediaCanvas = ({
10833
11038
  editingIndex,
10834
11039
  editContent,
10835
11040
  onEditContentChange,
11041
+ editHashtags,
11042
+ onEditHashtagsChange,
10836
11043
  isLoading,
10837
11044
  activeIndex,
10838
11045
  onActiveChange: handleActiveChange,
@@ -13768,6 +13975,7 @@ exports.TagInput = TagInput;
13768
13975
  exports.TelegramIcon = TelegramIcon;
13769
13976
  exports.TokenUsageCard = TokenUsageCard;
13770
13977
  exports.TrialPlanCard = TrialPlanCard;
13978
+ exports.TwilioIcon = TwilioIcon;
13771
13979
  exports.UserMessage = UserMessage;
13772
13980
  exports.WhatsAppIcon = WhatsAppIcon;
13773
13981
  exports.Window = Window;