@opensite/ui 2.3.3 → 2.3.4

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.
@@ -8,6 +8,7 @@ var classVarianceAuthority = require('class-variance-authority');
8
8
  var jsxRuntime = require('react/jsx-runtime');
9
9
  var icon = require('@page-speed/icon');
10
10
  var img = require('@page-speed/img');
11
+ var usePlatformFromUrl = require('@opensite/hooks/usePlatformFromUrl');
11
12
 
12
13
  function _interopNamespace(e) {
13
14
  if (e && e.__esModule) return e;
@@ -830,6 +831,87 @@ var Section = React__namespace.default.forwardRef(
830
831
  }
831
832
  );
832
833
  Section.displayName = "Section";
834
+ var platformIconMap = {
835
+ instagram: "cib/instagram",
836
+ linkedin: "cib/linkedin",
837
+ google: "cib/google",
838
+ facebook: "cib/facebook",
839
+ tiktok: "cib/tiktok",
840
+ youtube: "cib/youtube",
841
+ yelp: "cib/yelp",
842
+ spotify: "cib/spotify",
843
+ apple: "cib/apple",
844
+ x: "line-md/twitter-x-alt",
845
+ github: "cib/github",
846
+ snapchat: "cib/snapchat",
847
+ discord: "cib/discord",
848
+ dev: "simple-icons/devdotto",
849
+ substack: "simple-icons/substack",
850
+ reddit: "cib/reddit",
851
+ pinterest: "cib/pinterest",
852
+ threads: "simple-icons/threads",
853
+ twitch: "cib/twitch",
854
+ whatsapp: "cib/whatsapp",
855
+ telegram: "cib/telegram",
856
+ medium: "simple-icons/medium",
857
+ patreon: "cib/patreon",
858
+ onlyfans: "simple-icons/onlyfans",
859
+ eventbrite: "cib/eventbrite",
860
+ npmjs: "simple-icons/npm",
861
+ crates: "cib/rust",
862
+ rubygems: "cib/rubygems",
863
+ behance: "cib/behance",
864
+ dribbble: "cib/dribbble",
865
+ unknown: "icon-park-solid/circular-connection"
866
+ };
867
+ var SocialLinkIcon = React__namespace.forwardRef(
868
+ ({
869
+ platformName,
870
+ label,
871
+ iconSize = 20,
872
+ iconColor,
873
+ href,
874
+ iconClassName,
875
+ className,
876
+ iconNameOverride,
877
+ ...pressableProps
878
+ }, ref) => {
879
+ const platform = usePlatformFromUrl.usePlatformFromUrl(href);
880
+ const smartPlatformName = React__namespace.useMemo(() => {
881
+ return platform || platformName;
882
+ }, [platform, platformName]);
883
+ const iconName = React__namespace.useMemo(() => {
884
+ return iconNameOverride || platformIconMap[smartPlatformName];
885
+ }, [iconNameOverride, smartPlatformName]);
886
+ const accessibleLabel = React__namespace.useMemo(() => {
887
+ return label || platformName;
888
+ }, [label, platformName]);
889
+ return /* @__PURE__ */ jsxRuntime.jsx(
890
+ Pressable,
891
+ {
892
+ ref,
893
+ href,
894
+ "aria-label": accessibleLabel,
895
+ className: cn(
896
+ "inline-flex items-center justify-center transition-colors",
897
+ className
898
+ ),
899
+ ...pressableProps,
900
+ children: /* @__PURE__ */ jsxRuntime.jsx(
901
+ DynamicIcon,
902
+ {
903
+ name: iconName,
904
+ size: iconSize,
905
+ color: iconColor,
906
+ className: iconClassName,
907
+ alt: accessibleLabel
908
+ }
909
+ )
910
+ }
911
+ );
912
+ }
913
+ );
914
+ SocialLinkIcon.displayName = "SocialLinkIcon";
833
915
  function LinkPageBentoLayout({
834
916
  name,
835
917
  bio,
@@ -884,34 +966,22 @@ function LinkPageBentoLayout({
884
966
  const renderSocialLinks = React.useMemo(() => {
885
967
  if (socialLinksSlot) return socialLinksSlot;
886
968
  if (!socialLinks || socialLinks.length === 0) return null;
887
- return /* @__PURE__ */ jsxRuntime.jsx("div", { className: cn("flex items-center gap-2 pt-1", socialLinksClassName), children: socialLinks.map((social, index) => {
888
- const { iconName, ...socialPressableProps } = social;
889
- const icon = social.icon || (iconName ? /* @__PURE__ */ jsxRuntime.jsx(
890
- DynamicIcon,
891
- {
892
- name: iconName,
893
- size: 18,
894
- className: socialIconClassName
895
- }
896
- ) : null);
897
- const ariaLabel = social["aria-label"] || (typeof social.label === "string" ? social.label : void 0) || social.platform;
898
- return /* @__PURE__ */ jsxRuntime.jsx(
899
- Pressable,
900
- {
901
- ...socialPressableProps,
902
- "aria-label": ariaLabel,
903
- className: cn(
904
- "rounded-full p-2 transition-all duration-200",
905
- "hover:scale-110 active:scale-95",
906
- "hover:opacity-80",
907
- socialLinkClassName,
908
- social.className
909
- ),
910
- children: icon
911
- },
912
- social.id ?? index
913
- );
914
- }) });
969
+ return /* @__PURE__ */ jsxRuntime.jsx("div", { className: cn("flex items-center gap-2 pt-1", socialLinksClassName), children: socialLinks.map((social, index) => /* @__PURE__ */ jsxRuntime.jsx(
970
+ SocialLinkIcon,
971
+ {
972
+ href: social.href,
973
+ label: social["aria-label"] || (typeof social.label === "string" ? social.label : void 0),
974
+ className: cn(
975
+ "rounded-full p-2 transition-all duration-200",
976
+ "hover:scale-110 active:scale-95",
977
+ "hover:opacity-80",
978
+ socialLinkClassName,
979
+ social.className
980
+ ),
981
+ iconClassName: socialIconClassName
982
+ },
983
+ social.id ?? social.href ?? index
984
+ )) });
915
985
  }, [
916
986
  socialLinksSlot,
917
987
  socialLinks,
@@ -7,6 +7,7 @@ import { cva } from 'class-variance-authority';
7
7
  import { jsx, jsxs, Fragment } from 'react/jsx-runtime';
8
8
  import { Icon } from '@page-speed/icon';
9
9
  import { Img } from '@page-speed/img';
10
+ import { usePlatformFromUrl } from '@opensite/hooks/usePlatformFromUrl';
10
11
 
11
12
  // components/blocks/link-page/link-page-bento-layout.tsx
12
13
  function cn(...inputs) {
@@ -809,6 +810,87 @@ var Section = React__default.forwardRef(
809
810
  }
810
811
  );
811
812
  Section.displayName = "Section";
813
+ var platformIconMap = {
814
+ instagram: "cib/instagram",
815
+ linkedin: "cib/linkedin",
816
+ google: "cib/google",
817
+ facebook: "cib/facebook",
818
+ tiktok: "cib/tiktok",
819
+ youtube: "cib/youtube",
820
+ yelp: "cib/yelp",
821
+ spotify: "cib/spotify",
822
+ apple: "cib/apple",
823
+ x: "line-md/twitter-x-alt",
824
+ github: "cib/github",
825
+ snapchat: "cib/snapchat",
826
+ discord: "cib/discord",
827
+ dev: "simple-icons/devdotto",
828
+ substack: "simple-icons/substack",
829
+ reddit: "cib/reddit",
830
+ pinterest: "cib/pinterest",
831
+ threads: "simple-icons/threads",
832
+ twitch: "cib/twitch",
833
+ whatsapp: "cib/whatsapp",
834
+ telegram: "cib/telegram",
835
+ medium: "simple-icons/medium",
836
+ patreon: "cib/patreon",
837
+ onlyfans: "simple-icons/onlyfans",
838
+ eventbrite: "cib/eventbrite",
839
+ npmjs: "simple-icons/npm",
840
+ crates: "cib/rust",
841
+ rubygems: "cib/rubygems",
842
+ behance: "cib/behance",
843
+ dribbble: "cib/dribbble",
844
+ unknown: "icon-park-solid/circular-connection"
845
+ };
846
+ var SocialLinkIcon = React.forwardRef(
847
+ ({
848
+ platformName,
849
+ label,
850
+ iconSize = 20,
851
+ iconColor,
852
+ href,
853
+ iconClassName,
854
+ className,
855
+ iconNameOverride,
856
+ ...pressableProps
857
+ }, ref) => {
858
+ const platform = usePlatformFromUrl(href);
859
+ const smartPlatformName = React.useMemo(() => {
860
+ return platform || platformName;
861
+ }, [platform, platformName]);
862
+ const iconName = React.useMemo(() => {
863
+ return iconNameOverride || platformIconMap[smartPlatformName];
864
+ }, [iconNameOverride, smartPlatformName]);
865
+ const accessibleLabel = React.useMemo(() => {
866
+ return label || platformName;
867
+ }, [label, platformName]);
868
+ return /* @__PURE__ */ jsx(
869
+ Pressable,
870
+ {
871
+ ref,
872
+ href,
873
+ "aria-label": accessibleLabel,
874
+ className: cn(
875
+ "inline-flex items-center justify-center transition-colors",
876
+ className
877
+ ),
878
+ ...pressableProps,
879
+ children: /* @__PURE__ */ jsx(
880
+ DynamicIcon,
881
+ {
882
+ name: iconName,
883
+ size: iconSize,
884
+ color: iconColor,
885
+ className: iconClassName,
886
+ alt: accessibleLabel
887
+ }
888
+ )
889
+ }
890
+ );
891
+ }
892
+ );
893
+ SocialLinkIcon.displayName = "SocialLinkIcon";
812
894
  function LinkPageBentoLayout({
813
895
  name,
814
896
  bio,
@@ -863,34 +945,22 @@ function LinkPageBentoLayout({
863
945
  const renderSocialLinks = useMemo(() => {
864
946
  if (socialLinksSlot) return socialLinksSlot;
865
947
  if (!socialLinks || socialLinks.length === 0) return null;
866
- return /* @__PURE__ */ jsx("div", { className: cn("flex items-center gap-2 pt-1", socialLinksClassName), children: socialLinks.map((social, index) => {
867
- const { iconName, ...socialPressableProps } = social;
868
- const icon = social.icon || (iconName ? /* @__PURE__ */ jsx(
869
- DynamicIcon,
870
- {
871
- name: iconName,
872
- size: 18,
873
- className: socialIconClassName
874
- }
875
- ) : null);
876
- const ariaLabel = social["aria-label"] || (typeof social.label === "string" ? social.label : void 0) || social.platform;
877
- return /* @__PURE__ */ jsx(
878
- Pressable,
879
- {
880
- ...socialPressableProps,
881
- "aria-label": ariaLabel,
882
- className: cn(
883
- "rounded-full p-2 transition-all duration-200",
884
- "hover:scale-110 active:scale-95",
885
- "hover:opacity-80",
886
- socialLinkClassName,
887
- social.className
888
- ),
889
- children: icon
890
- },
891
- social.id ?? index
892
- );
893
- }) });
948
+ return /* @__PURE__ */ jsx("div", { className: cn("flex items-center gap-2 pt-1", socialLinksClassName), children: socialLinks.map((social, index) => /* @__PURE__ */ jsx(
949
+ SocialLinkIcon,
950
+ {
951
+ href: social.href,
952
+ label: social["aria-label"] || (typeof social.label === "string" ? social.label : void 0),
953
+ className: cn(
954
+ "rounded-full p-2 transition-all duration-200",
955
+ "hover:scale-110 active:scale-95",
956
+ "hover:opacity-80",
957
+ socialLinkClassName,
958
+ social.className
959
+ ),
960
+ iconClassName: socialIconClassName
961
+ },
962
+ social.id ?? social.href ?? index
963
+ )) });
894
964
  }, [
895
965
  socialLinksSlot,
896
966
  socialLinks,
@@ -8,6 +8,7 @@ var classVarianceAuthority = require('class-variance-authority');
8
8
  var jsxRuntime = require('react/jsx-runtime');
9
9
  var icon = require('@page-speed/icon');
10
10
  var img = require('@page-speed/img');
11
+ var usePlatformFromUrl = require('@opensite/hooks/usePlatformFromUrl');
11
12
 
12
13
  function _interopNamespace(e) {
13
14
  if (e && e.__esModule) return e;
@@ -830,6 +831,87 @@ var Section = React__namespace.default.forwardRef(
830
831
  }
831
832
  );
832
833
  Section.displayName = "Section";
834
+ var platformIconMap = {
835
+ instagram: "cib/instagram",
836
+ linkedin: "cib/linkedin",
837
+ google: "cib/google",
838
+ facebook: "cib/facebook",
839
+ tiktok: "cib/tiktok",
840
+ youtube: "cib/youtube",
841
+ yelp: "cib/yelp",
842
+ spotify: "cib/spotify",
843
+ apple: "cib/apple",
844
+ x: "line-md/twitter-x-alt",
845
+ github: "cib/github",
846
+ snapchat: "cib/snapchat",
847
+ discord: "cib/discord",
848
+ dev: "simple-icons/devdotto",
849
+ substack: "simple-icons/substack",
850
+ reddit: "cib/reddit",
851
+ pinterest: "cib/pinterest",
852
+ threads: "simple-icons/threads",
853
+ twitch: "cib/twitch",
854
+ whatsapp: "cib/whatsapp",
855
+ telegram: "cib/telegram",
856
+ medium: "simple-icons/medium",
857
+ patreon: "cib/patreon",
858
+ onlyfans: "simple-icons/onlyfans",
859
+ eventbrite: "cib/eventbrite",
860
+ npmjs: "simple-icons/npm",
861
+ crates: "cib/rust",
862
+ rubygems: "cib/rubygems",
863
+ behance: "cib/behance",
864
+ dribbble: "cib/dribbble",
865
+ unknown: "icon-park-solid/circular-connection"
866
+ };
867
+ var SocialLinkIcon = React__namespace.forwardRef(
868
+ ({
869
+ platformName,
870
+ label,
871
+ iconSize = 20,
872
+ iconColor,
873
+ href,
874
+ iconClassName,
875
+ className,
876
+ iconNameOverride,
877
+ ...pressableProps
878
+ }, ref) => {
879
+ const platform = usePlatformFromUrl.usePlatformFromUrl(href);
880
+ const smartPlatformName = React__namespace.useMemo(() => {
881
+ return platform || platformName;
882
+ }, [platform, platformName]);
883
+ const iconName = React__namespace.useMemo(() => {
884
+ return iconNameOverride || platformIconMap[smartPlatformName];
885
+ }, [iconNameOverride, smartPlatformName]);
886
+ const accessibleLabel = React__namespace.useMemo(() => {
887
+ return label || platformName;
888
+ }, [label, platformName]);
889
+ return /* @__PURE__ */ jsxRuntime.jsx(
890
+ Pressable,
891
+ {
892
+ ref,
893
+ href,
894
+ "aria-label": accessibleLabel,
895
+ className: cn(
896
+ "inline-flex items-center justify-center transition-colors",
897
+ className
898
+ ),
899
+ ...pressableProps,
900
+ children: /* @__PURE__ */ jsxRuntime.jsx(
901
+ DynamicIcon,
902
+ {
903
+ name: iconName,
904
+ size: iconSize,
905
+ color: iconColor,
906
+ className: iconClassName,
907
+ alt: accessibleLabel
908
+ }
909
+ )
910
+ }
911
+ );
912
+ }
913
+ );
914
+ SocialLinkIcon.displayName = "SocialLinkIcon";
833
915
  function LinkPageGridCards({
834
916
  name,
835
917
  bio,
@@ -928,34 +1010,22 @@ function LinkPageGridCards({
928
1010
  "flex items-center justify-center gap-2",
929
1011
  socialLinksClassName
930
1012
  ),
931
- children: socialLinks.map((social, index) => {
932
- const { iconName, ...socialPressableProps } = social;
933
- const icon = social.icon || (iconName ? /* @__PURE__ */ jsxRuntime.jsx(
934
- DynamicIcon,
935
- {
936
- name: iconName,
937
- size: 18,
938
- className: socialIconClassName
939
- }
940
- ) : null);
941
- const ariaLabel = social["aria-label"] || (typeof social.label === "string" ? social.label : void 0) || social.platform;
942
- return /* @__PURE__ */ jsxRuntime.jsx(
943
- Pressable,
944
- {
945
- ...socialPressableProps,
946
- "aria-label": ariaLabel,
947
- className: cn(
948
- "rounded-lg p-2 transition-all duration-200",
949
- "bg-card text-card-foreground hover:opacity-80",
950
- "size-12 flex items-center justify-center",
951
- socialLinkClassName,
952
- social.className
953
- ),
954
- children: icon
955
- },
956
- social.id ?? index
957
- );
958
- })
1013
+ children: socialLinks.map((social, index) => /* @__PURE__ */ jsxRuntime.jsx(
1014
+ SocialLinkIcon,
1015
+ {
1016
+ href: social.href,
1017
+ label: social["aria-label"] || (typeof social.label === "string" ? social.label : void 0),
1018
+ className: cn(
1019
+ "rounded-lg p-2 transition-all duration-200",
1020
+ "bg-card text-card-foreground hover:opacity-80",
1021
+ "size-12 flex items-center justify-center",
1022
+ socialLinkClassName,
1023
+ social.className
1024
+ ),
1025
+ iconClassName: socialIconClassName
1026
+ },
1027
+ social.id ?? social.href ?? index
1028
+ ))
959
1029
  }
960
1030
  );
961
1031
  }, [
@@ -7,6 +7,7 @@ import { cva } from 'class-variance-authority';
7
7
  import { jsx, jsxs, Fragment } from 'react/jsx-runtime';
8
8
  import { Icon } from '@page-speed/icon';
9
9
  import { Img } from '@page-speed/img';
10
+ import { usePlatformFromUrl } from '@opensite/hooks/usePlatformFromUrl';
10
11
 
11
12
  // components/blocks/link-page/link-page-grid-cards.tsx
12
13
  function cn(...inputs) {
@@ -809,6 +810,87 @@ var Section = React__default.forwardRef(
809
810
  }
810
811
  );
811
812
  Section.displayName = "Section";
813
+ var platformIconMap = {
814
+ instagram: "cib/instagram",
815
+ linkedin: "cib/linkedin",
816
+ google: "cib/google",
817
+ facebook: "cib/facebook",
818
+ tiktok: "cib/tiktok",
819
+ youtube: "cib/youtube",
820
+ yelp: "cib/yelp",
821
+ spotify: "cib/spotify",
822
+ apple: "cib/apple",
823
+ x: "line-md/twitter-x-alt",
824
+ github: "cib/github",
825
+ snapchat: "cib/snapchat",
826
+ discord: "cib/discord",
827
+ dev: "simple-icons/devdotto",
828
+ substack: "simple-icons/substack",
829
+ reddit: "cib/reddit",
830
+ pinterest: "cib/pinterest",
831
+ threads: "simple-icons/threads",
832
+ twitch: "cib/twitch",
833
+ whatsapp: "cib/whatsapp",
834
+ telegram: "cib/telegram",
835
+ medium: "simple-icons/medium",
836
+ patreon: "cib/patreon",
837
+ onlyfans: "simple-icons/onlyfans",
838
+ eventbrite: "cib/eventbrite",
839
+ npmjs: "simple-icons/npm",
840
+ crates: "cib/rust",
841
+ rubygems: "cib/rubygems",
842
+ behance: "cib/behance",
843
+ dribbble: "cib/dribbble",
844
+ unknown: "icon-park-solid/circular-connection"
845
+ };
846
+ var SocialLinkIcon = React.forwardRef(
847
+ ({
848
+ platformName,
849
+ label,
850
+ iconSize = 20,
851
+ iconColor,
852
+ href,
853
+ iconClassName,
854
+ className,
855
+ iconNameOverride,
856
+ ...pressableProps
857
+ }, ref) => {
858
+ const platform = usePlatformFromUrl(href);
859
+ const smartPlatformName = React.useMemo(() => {
860
+ return platform || platformName;
861
+ }, [platform, platformName]);
862
+ const iconName = React.useMemo(() => {
863
+ return iconNameOverride || platformIconMap[smartPlatformName];
864
+ }, [iconNameOverride, smartPlatformName]);
865
+ const accessibleLabel = React.useMemo(() => {
866
+ return label || platformName;
867
+ }, [label, platformName]);
868
+ return /* @__PURE__ */ jsx(
869
+ Pressable,
870
+ {
871
+ ref,
872
+ href,
873
+ "aria-label": accessibleLabel,
874
+ className: cn(
875
+ "inline-flex items-center justify-center transition-colors",
876
+ className
877
+ ),
878
+ ...pressableProps,
879
+ children: /* @__PURE__ */ jsx(
880
+ DynamicIcon,
881
+ {
882
+ name: iconName,
883
+ size: iconSize,
884
+ color: iconColor,
885
+ className: iconClassName,
886
+ alt: accessibleLabel
887
+ }
888
+ )
889
+ }
890
+ );
891
+ }
892
+ );
893
+ SocialLinkIcon.displayName = "SocialLinkIcon";
812
894
  function LinkPageGridCards({
813
895
  name,
814
896
  bio,
@@ -907,34 +989,22 @@ function LinkPageGridCards({
907
989
  "flex items-center justify-center gap-2",
908
990
  socialLinksClassName
909
991
  ),
910
- children: socialLinks.map((social, index) => {
911
- const { iconName, ...socialPressableProps } = social;
912
- const icon = social.icon || (iconName ? /* @__PURE__ */ jsx(
913
- DynamicIcon,
914
- {
915
- name: iconName,
916
- size: 18,
917
- className: socialIconClassName
918
- }
919
- ) : null);
920
- const ariaLabel = social["aria-label"] || (typeof social.label === "string" ? social.label : void 0) || social.platform;
921
- return /* @__PURE__ */ jsx(
922
- Pressable,
923
- {
924
- ...socialPressableProps,
925
- "aria-label": ariaLabel,
926
- className: cn(
927
- "rounded-lg p-2 transition-all duration-200",
928
- "bg-card text-card-foreground hover:opacity-80",
929
- "size-12 flex items-center justify-center",
930
- socialLinkClassName,
931
- social.className
932
- ),
933
- children: icon
934
- },
935
- social.id ?? index
936
- );
937
- })
992
+ children: socialLinks.map((social, index) => /* @__PURE__ */ jsx(
993
+ SocialLinkIcon,
994
+ {
995
+ href: social.href,
996
+ label: social["aria-label"] || (typeof social.label === "string" ? social.label : void 0),
997
+ className: cn(
998
+ "rounded-lg p-2 transition-all duration-200",
999
+ "bg-card text-card-foreground hover:opacity-80",
1000
+ "size-12 flex items-center justify-center",
1001
+ socialLinkClassName,
1002
+ social.className
1003
+ ),
1004
+ iconClassName: socialIconClassName
1005
+ },
1006
+ social.id ?? social.href ?? index
1007
+ ))
938
1008
  }
939
1009
  );
940
1010
  }, [